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

sql: disallow cross-database type references in CTAS #105579

Conversation

chengxiong-ruan
Copy link
Contributor

Fixes: #105393

Release note (bug fix): reviously, cross-database type references could sneaked in through CREATE TABLE...AS statements if the source table is from another database and any of its columns is of a user defined type. This introduced bug where the source table can be dropped and type could not be found for the CTAS table. This commit disallow such CTAS as a fix.

Fixes: cockroachdb#105393

Release note (bug fix): reviously, cross-database type references
could sneaked in through `CREATE TABLE...AS` statements if the
source table is from another database and any of its columns is of
a user defined type. This introduced bug where the source table
can be dropped and type could not be found for the CTAS table.
This commit disallow such CTAS as a fix.
@chengxiong-ruan chengxiong-ruan requested a review from a team as a code owner June 26, 2023 20:48
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@chengxiong-ruan chengxiong-ruan added backport-22.2.x backport-23.1.x Flags PRs that need to be backported to 23.1 labels Jun 26, 2023
Copy link
Contributor

@postamar postamar left a comment

Choose a reason for hiding this comment

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

Yikes! Good catch.

@chengxiong-ruan
Copy link
Contributor Author

TFTR!
bors r+

@craig
Copy link
Contributor

craig bot commented Jun 27, 2023

Build succeeded:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-23.1.x Flags PRs that need to be backported to 23.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CTAS: mistakenly allowed cross-db type references
3 participants