Skip to content

sql: do not ignore unique partial predicate in ALTER TABLE#68629

Merged
craig[bot] merged 1 commit into
cockroachdb:masterfrom
mgartner:fix-alter-table-partial-unique-constraint
Aug 11, 2021
Merged

sql: do not ignore unique partial predicate in ALTER TABLE#68629
craig[bot] merged 1 commit into
cockroachdb:masterfrom
mgartner:fix-alter-table-partial-unique-constraint

Conversation

@mgartner

Copy link
Copy Markdown
Contributor

Previously, a WHERE clause in ALTER TABLE .. ADD CONSTRAINT .. UNIQUE
statements was parsed successfully but ignored so that the resulting
unique constraint was not partial. This commit fixes this bug.

Fixes #67234

Release note (bug fix): A bug has been fixed that created non-partial
unique constraints when a user attempted to create a partial unique
constraint in ALTER TABLE statements.

@mgartner mgartner requested review from ajwerner and vy-ton August 10, 2021 00:54
@cockroach-teamcity

Copy link
Copy Markdown
Member

This change is Reviewable

@vy-ton vy-ton 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

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

I'm still interested in doing something about CreatedExplictly but that can and should happen separately.

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained

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

One nit is that this isn't really an opt change, it's more a regular ol' sql change.

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained

@mgartner

Copy link
Copy Markdown
Contributor Author

One nit is that this isn't really an opt change, it's more a regular ol' sql change.

Heh, a muscle-memory typo. Thanks for pointing it out.

@mgartner mgartner force-pushed the fix-alter-table-partial-unique-constraint branch from a3e061c to a4a4177 Compare August 10, 2021 23:51
@mgartner mgartner changed the title opt: do not ignore unique partial predicate in ALTER TABLE sql: do not ignore unique partial predicate in ALTER TABLE Aug 10, 2021
@mgartner

Copy link
Copy Markdown
Contributor Author

TFTRs!

bors r+

@craig

craig Bot commented Aug 11, 2021

Copy link
Copy Markdown
Contributor

Build failed:

@mgartner

Copy link
Copy Markdown
Contributor Author

Looks like a flake.

bors r+

@craig

craig Bot commented Aug 11, 2021

Copy link
Copy Markdown
Contributor

Build failed:

Previously, a `WHERE` clause in `ALTER TABLE .. ADD CONSTRAINT .. UNIQUE`
statements was parsed successfully but ignored so that the resulting
unique constraint was not partial. This commit fixes this bug.

Fixes cockroachdb#67234

Release note (bug fix): A bug has been fixed that created non-partial
unique constraints when a user attempted to create a partial unique
constraint in `ALTER TABLE` statements.
@mgartner mgartner force-pushed the fix-alter-table-partial-unique-constraint branch from a4a4177 to b829d85 Compare August 11, 2021 16:55
@mgartner

Copy link
Copy Markdown
Contributor Author

bors r+

@craig

craig Bot commented Aug 11, 2021

Copy link
Copy Markdown
Contributor

Build failed (retrying...):

@mgartner

Copy link
Copy Markdown
Contributor Author

bors r-

@craig

craig Bot commented Aug 11, 2021

Copy link
Copy Markdown
Contributor

Canceled.

@mgartner

Copy link
Copy Markdown
Contributor Author

bors r+

@craig

craig Bot commented Aug 11, 2021

Copy link
Copy Markdown
Contributor

Build succeeded:

@craig craig Bot merged commit 5efb168 into cockroachdb:master Aug 11, 2021
@blathers-crl

blathers-crl Bot commented Aug 11, 2021

Copy link
Copy Markdown

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from b829d85 to blathers/backport-release-20.2-68629: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 20.2.x failed. See errors above.


error creating merge commit from b829d85 to blathers/backport-release-21.1-68629: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 21.1.x failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

@mgartner mgartner deleted the fix-alter-table-partial-unique-constraint branch August 11, 2021 23:30
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: predicate ignored when adding unique constraint

4 participants