sql: allow database prefixes for schema names#55647
Merged
craig[bot] merged 4 commits intocockroachdb:masterfrom Oct 27, 2020
Merged
sql: allow database prefixes for schema names#55647craig[bot] merged 4 commits intocockroachdb:masterfrom
craig[bot] merged 4 commits intocockroachdb:masterfrom
Conversation
Member
9830144 to
ebf5364
Compare
dbfcc28 to
f306633
Compare
ajwerner
approved these changes
Oct 27, 2020
Contributor
ajwerner
left a comment
There was a problem hiding this comment.
This is really great work!
Reviewed 7 of 7 files at r1, 9 of 9 files at r2, 6 of 6 files at r3, 9 of 9 files at r4.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @jayshrivastava)
pkg/sql/drop_schema.go, line 100 at r2 (raw file):
} if err := d.resolveCollectedObjects(ctx, p, nil); err != nil {
why is this now nil? maybe add some commentary.
Also, our style guide is that you should comment the parameter when passing nil with /* db */
f306633 to
0052db3
Compare
The CREATE SCHEMA statement was expanded to allow schema names prefixed with database names. For example, the statement `CREATE SCHEMA other_db.schema_name` is valid. Release note (sql change): The CREATE SCHEMA statement was expanded to allow schema names prefixed with database names.
The DROP SCHEMA statement was expanded to allow schema names prefixed with database names. For example, the statement `DROP SCHEMA schema_name, other_db.schema_name CASCADE` is valid. Release note (sql change): The DROP SCHEMA statement was expanded to allow schema names prefixed with database names.
The ALTER SCHEMA statement was expanded to allow the source schema to be prefixed with a database name. For example, `ALTER SCHEMA other_db.schema_name RENAME TO schema_name_1` is valid. Release note (sql change): The ALTER SCHEMA statement was expanded to allow the source schema to be prefixed with a database name.
The statements GRANT ... ON SCHEMA ..., REVOKE ... ON SCHEMA ..., and SHOW GRANTS ON SCHEMA ... were all updated to allow schema names prefixed with database names. Release note (sql change): The statements GRANT ... ON SCHEMA ..., REVOKE ... ON SCHEMA ..., and SHOW GRANTS ON SCHEMA ... were all updated to allow schema names prefixed with database names.
0052db3 to
45e3a80
Compare
Contributor
Author
|
bors r=ajwerner |
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.
This PR adds optional database prefixes to schemas for the following ops:
CREATE SCHEMA ...DROP SCHEMA ...ALTER SCHEMA(only the source schema can be prefixed to prevent changing the database of a schema usingALTER SCHEMA thisdb.foo RENAME TO otherdb.bar)GRANT ... ON SCHEMA ...REVOKE ... ON SCHEMA ...SHOW GRANTS ON SCHEMA ...Schema names in statements such as
ALTER TYPE t SET SCHEMAorALTER TABLE t SET SCHEMAetc currently do not take database prefixes (this remains unchanged in this PR) to discourage the creation of cross database relations. Discussion notes for this are here.Resolves #54295