cherry-pick 2.0: sql: fix the handling of current_schema and search_path#24758
Merged
craig[bot] merged 1 commit intocockroachdb:release-2.0from Apr 13, 2018
Merged
Conversation
Prior to this patch, CockroachDB was following the pg docs to the letter regarding the relationship between `search_path` and the "current schema": the current schema was taken to always be the first item in `search_path`, as indicated in https://www.postgresql.org/docs/10/static/functions-info.html ("current_schema returns the name of the schema that is first in the search path (or a null value if the search path is empty).") This in turn impacts the creation of objects (tables, views, etc) when the name is unqualified: pg also specifies that such objects are to be created in the current schema. Unfortunately the pg doc is incorrect, as pg has a more nuanced behavior: only the _valid_ schemas in `search_path` are considered to determine the current schema in that way. This was causing an unfortunate visible compatibility bug: if the user specified an invalid schema in the search path, subsequent create operations would fail with CockroachDB and succeed with pg. This patch corrects this issue by adopting pg's behavior. Ditto for `current_schemas`. Release note (sql change, bug fix): the built-in functions `current_schema` and `current_schemas` now only consider valid schemas, like PostgreSQL does.
Member
bdarnell
approved these changes
Apr 13, 2018
justinj
approved these changes
Apr 13, 2018
Contributor
Author
|
bors r+ |
Contributor
Build succeeded |
This file contains hidden or 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
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.
Picks #24718.
cc @cockroachdb/release