Skip to content

sql: fix bug preventing adding FKs referencing hidden columns#59659

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
thoszhang:fix-hidden-column-fks
Feb 1, 2021
Merged

sql: fix bug preventing adding FKs referencing hidden columns#59659
craig[bot] merged 1 commit intocockroachdb:masterfrom
thoszhang:fix-hidden-column-fks

Conversation

@thoszhang
Copy link
Copy Markdown

The validation query for adding foreign keys had a pointless SELECT *
on the referenced table that caused hidden columns to be omitted,
so attempting to add foreign key constraints referencing hidden columns
would fail. This PR fixes the query.

Fixes #59582.

Release note (bug fix): Fixed a bug preventing foreign key constraints
referencing hidden columns (e.g., rowid) from being added.

The validation query for adding foreign keys had a pointless `SELECT *`
on the referenced table that caused hidden columns to be omitted,
so attempting to add foreign key constraints referencing hidden columns
would fail. This PR fixes the query.

Release note (bug fix): Fixed a bug preventing foreign key constraints
referencing hidden columns (e.g., `rowid`) from being added.
@thoszhang thoszhang requested a review from ajwerner February 1, 2021 17:59
@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

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Feb 1, 2021

Build succeeded:

@craig craig bot merged commit f37712a into cockroachdb:master Feb 1, 2021
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.

sql: error on internal validation query for foreign keys referencing hidden columns

3 participants