-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
24718: sql: fix the handling of current_schema and search_path r=knz a=knz Fixes #24472. 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/9.6/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. Co-authored-by: Raphael 'kena' Poss <knz@cockroachlabs.com>
- Loading branch information
Showing
9 changed files
with
122 additions
and
45 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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