Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql,pgwire: fix a host of pgwire/sql interaction bugs #30702

Merged
merged 4 commits into from
Oct 5, 2018

Commits on Oct 5, 2018

  1. sql: add error handling to the connExecutor constructor

    Release note: None
    knz committed Oct 5, 2018
    Configuration menu
    Copy the full SHA
    4e412dd View commit details
    Browse the repository at this point in the history
  2. pgwire: add missing logging to the connection test code

    Release note: None
    knz committed Oct 5, 2018
    Configuration menu
    Copy the full SHA
    38e50b2 View commit details
    Browse the repository at this point in the history
  3. sql: properly ignore invalid chars in encoding names

    Release note (bug fix): CockroachDB now properly ignores
    non-alphanumeric characters in encoding names passed to
    `convert_from()`, `client_encoding`, etc., for compatibility with
    PostgreSQL.
    knz committed Oct 5, 2018
    Configuration menu
    Copy the full SHA
    c31e83a View commit details
    Browse the repository at this point in the history
  4. sql,pgwire: fix a host of pgwire/sql interaction bugs

    Prior to this patch, CockroachDB:
    
    - incorrectly ignored the `extra_float_digits` client
      parameter.
    - improperly reported `ISO` as default value for server
      status parameter and session var `DateStyle` (the pg
      default is `ISO, MDY`.
    - failed to report `TimeZone`, `is_superuser` and
      `session_authorization` in the server status parameters.
    - failed to report the correct (and client-provided) value of
      `application_name` in the server status parameters.
    - did not report the correct defaults in `pg_catalog.pg_settings`.
    
    This patch corrects these various bugs by:
    
    - keeping the client-provided parameters as session defaults, to be
      picked up by RESET and pg_settings. (Prior to this patch, the
      client parameters were discarded after setting up the session
      initially.)
    - extending the handling of session variables to support reporting
      their current value during connection intiialization. This way
      the server status parameter can report the session variables
      that were just initialized from the client-provided defaults.
    - eliminating the ad-hoc constant list of "statusServerParams"
      maintained in pgwire/conn.go, which could dangerously go out of sync
      with the session variable defaults without anyone noticing.
    - adding the missing reports for `is_superuser` and
      `session_authorization`.
    
    Because CockroachDB now properly honors the value of
    extra_float_digits provided by the client, any test that uses lib/pq
    must now account for the fact that lib/pq automatically sets this
    parameter to 2. The logic_test code is modified accordingly.
    
    Because CockroachDB now properly reports the current TimeZone
    parameter to the client during connection initialization, any test
    that uses lib/pq must now account for the fact that lib/pq will load
    that zone name into any parsed timestamp value coming from the
    server. The tests that print out timestamps have been modified
    accordingly.
    
    As a side effect of this fix, it is now possible to set arbitrary
    session variables in the client connection URL. This has another
    benefit reported in the release notes below.
    
    Release note (bug fix): CockroachDB now properly recognizes the value
    of `extra_float_digits` provided by clients as a connection parameter.
    
    Release note (bug fix): CockroachDB now properly recognizes two-part
    values for the session variable and connection parameter `DateStyle`,
    for compatibility with PostgreSQL.
    
    Release note (bug fix): CockroachDB now reports all server status
    parameters supported by PostgreSQL when setting up a session. This is
    expected to improve compatibility with some drivers.
    
    Release note (bug fix): CockroachDB now properly uses the
    client-provided default values when using the RESET statement (or SET
    ... = DEFAULT).
    
    Release note (bug fix): CockroachDB now properly fills the columns
    `boot_val` and `reset_val` in `pg_catalog.pg_settings` for better
    compatibility with PostgreSQL.
    
    Release note (cli change): It is now possible to provide
    initial/default values for any customizable session variable in the
    client connection URL.
    
    Release note (sql change): CockroachDB now supports more
    customizations from PostgreSQL client drivers when initially setting
    up the client connection.
    knz committed Oct 5, 2018
    Configuration menu
    Copy the full SHA
    c89e0a9 View commit details
    Browse the repository at this point in the history