-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
release-2.1: sql,pgwire: fix a host of pgwire/sql interaction bugs #31002
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Release note: None
Release note: None
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.
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.
This is a large PR. I don't really know what's in it; presumably you have a good reason for backporting :) |
benesch
approved these changes
Oct 5, 2018
Superseded by #31021. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport 4/4 commits from #30702.
/cc @cockroachdb/release
First commit from #30691.
Fixes #30701.
Fixes #30692.
Fixes #30693.
Fixes #30697.
Fixes #30698.
Fixes #30703.
Informs #30717.
With special thanks to @benesch for asking me to poke at this.