Skip to content

sql: disallow moving tables with user-defined types into a different DB#55779

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
thoszhang:fix-rename-cross-db-types
Oct 20, 2020
Merged

sql: disallow moving tables with user-defined types into a different DB#55779
craig[bot] merged 1 commit intocockroachdb:masterfrom
thoszhang:fix-rename-cross-db-types

Conversation

@thoszhang
Copy link
Copy Markdown

We disallow columns using user-defined types in a different database
from the table at creation time. However, we have a loophole where it's
possible to move the table to a different database using RENAME and
thus create a cross-database reference. This breaks backup/restore and
is generally unintended. This PR adds a check to disallow this.

Partially addresses #55709.
Related to #55772.

Release note (bug fix): Tables can no longer be moved to a different
database using RENAME if they have columns using user-defined types
(enums).

We disallow columns using user-defined types in a different database
from the table at creation time. However, we have a loophole where it's
possible to move the table to a different database using `RENAME` and
thus create a cross-database reference. This breaks backup/restore and
is generally unintended. This PR adds a check to disallow this.

Release note (bug fix): Tables can no longer be moved to a different
database using `RENAME` if they have columns using user-defined types
(enums).
@thoszhang thoszhang requested a review from ajwerner October 20, 2020 20:46
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Contributor

@ajwerner ajwerner 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

@thoszhang
Copy link
Copy Markdown
Author

TFTR, let's see what happens with the tests.

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Oct 20, 2020

Build succeeded:

@craig craig bot merged commit ae78ca7 into cockroachdb:master Oct 20, 2020
@thoszhang thoszhang deleted the fix-rename-cross-db-types branch October 20, 2020 22:43
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.

3 participants