Skip to content

sql: improve expression index usability#67197

Merged
craig[bot] merged 5 commits into
cockroachdb:masterfrom
mgartner:inaccessible-column-renaming
Jul 15, 2021
Merged

sql: improve expression index usability#67197
craig[bot] merged 5 commits into
cockroachdb:masterfrom
mgartner:inaccessible-column-renaming

Conversation

@mgartner

@mgartner mgartner commented Jul 3, 2021

Copy link
Copy Markdown
Contributor

sql: do not allow renaming inaccessible columns

Release note: None

sql: do not allow inaccessible columns in primary keys

Release note: None

sql: support expressions in unique constraints

Postgres does not allow expressions in unique constraints, but it does
allow expressions in unique indexes. For now we allow expressions in
unique constraints, because we cannot differentiate between a unique
constraint and a unique index table definition: they are both parsed
into the same struct, tree.UniqueConstraintTableDef.

In the long term we may want to disallow expression in unique
constraints to be consistent with Postgres. We could do this by changing
the parser so that UNIQUE ((a + b)) does not parse successfully.
See #65825.

Release note: None

sql: better error message when creating a view with an inaccessible column

Previously, the error message returned when attempting to create a view
with an inaccessible column was confusing:

unimplemented: views do not currently support * expressions

The error message now reads:

column "x" does not exist

Release note: None

sql: do not allow inaccessible columns to be dropped

Release note: None

@mgartner mgartner requested review from a team July 3, 2021 00:18
@cockroach-teamcity

Copy link
Copy Markdown
Member

This change is Reviewable

@mgartner

mgartner commented Jul 3, 2021

Copy link
Copy Markdown
Contributor Author

The first commit is from #65703. Rebased.

@mgartner mgartner force-pushed the inaccessible-column-renaming branch 2 times, most recently from 27ddfe0 to 57fda29 Compare July 12, 2021 19:31
@mgartner

Copy link
Copy Markdown
Contributor Author

Friendly ping @RaduBerinde and @cucaroach :)

@cucaroach cucaroach left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

:LGTM:

Reviewed 1 of 2 files at r2, 11 of 11 files at r7, 9 of 9 files at r8, 9 of 9 files at r9, 9 of 9 files at r10, 9 of 9 files at r11.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @RaduBerinde)

@RaduBerinde RaduBerinde left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 2 files at r2, 1 of 9 files at r8, 1 of 9 files at r10, 9 of 9 files at r11.
Reviewable status: :shipit: complete! 2 of 0 LGTMs obtained (waiting on @mgartner)

mgartner added 5 commits July 15, 2021 09:46
Postgres does not allow expressions in unique constraints, but it does
allow expressions in unique indexes. For now we allow expressions in
unique constraints, because we cannot differentiate between a unique
constraint and a unique index table definition: they are both parsed
into the same struct, `tree.UniqueConstraintTableDef`.

In the long term we may want to disallow expression in unique
constraints to be consistent with Postgres. We could do this by changing
the parser so that `UNIQUE ((a + b))` does not parse successfully.
See cockroachdb#65825.

Release note: None
…olumn

Previously, the error message returned when attempting to create a view
with an inaccessible column was confusing:

    unimplemented: views do not currently support * expressions

The error message now reads:

    column "x" does not exist

Release note: None
@mgartner mgartner force-pushed the inaccessible-column-renaming branch from 57fda29 to 04c4412 Compare July 15, 2021 16:48
@mgartner

Copy link
Copy Markdown
Contributor Author

TFTRs!

bors r+

@craig craig Bot merged commit 21e78bb into cockroachdb:master Jul 15, 2021
@craig

craig Bot commented Jul 15, 2021

Copy link
Copy Markdown
Contributor

Build succeeded:

@mgartner mgartner deleted the inaccessible-column-renaming branch July 15, 2021 21:08
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