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

release-20.2: sql: ban renaming table to a new database unless both schemas are public #55723

Merged
merged 1 commit into from
Oct 20, 2020

Conversation

thoszhang
Copy link
Contributor

Backport 1/1 commits from #55722.

/cc @cockroachdb/release


Previously we would seemingly allow renaming tables to a new database
with arbitrary source and target schemas without ever actually
reassigning the schema ID. This could lead to a corrupted descriptor
with an invalid schema ID for the database. This PR fixes the
implementation to return an error when renaming a table to a different
database unless both the source and target schemas are public.

Fixes #55710.

Release note (bug fix): Previously, changing the parent database and
schema of a table using RENAME was seemingly permitted but would lead
to corruption of the table metadata. Now an error is returned when
attempting to rename a table to a different database except in the case
where both the source and target schemas are the public schema in each
database, which continues to be supported.

Previously we would seemingly allow renaming tables to a new database
with arbitrary source and target schemas without ever actually
reassigning the schema ID. This could lead to a corrupted descriptor
with an invalid schema ID for the database. This PR fixes the
implementation to return an error when renaming a table to a different
database unless both the source and target schemas are `public`.

Release note (bug fix): Previously, changing the parent database and
schema of a table using `RENAME` was seemingly permitted but would lead
to corruption of the table metadata. Now an error is returned when
attempting to rename a table to a different database except in the case
where both the source and target schemas are the `public` schema in each
database, which continues to be supported.
@thoszhang thoszhang requested a review from ajwerner October 20, 2020 01:41
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@thoszhang
Copy link
Contributor Author

First CI run flaked on #55718 so I'm starting another one.

Copy link
Member

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 2 of 2 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @ajwerner)

@thoszhang thoszhang merged commit 22271f4 into cockroachdb:release-20.2 Oct 20, 2020
@thoszhang thoszhang deleted the backport20.2-55722 branch October 20, 2020 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants