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: handle CONSTRAINT...UNIQUE with PARTITION BY ALL / REGIONAL BY ROW #59364

Merged
merged 2 commits into from
Jan 26, 2021

Conversation

otan
Copy link
Contributor

@otan otan commented Jan 24, 2021

sql: teach ADD UNIQUE CONSTRAINT to respect PARTITION ALL BY

Release note (sql change): Fix-up ALTER TABLE ... ADD CONSTRAINT ...
UNIQUE to partition correctly under a PARTITION ALL BY table.

sql: respect REGIONAL BY ROW when adding a new UNIQUE CONSTRAINT

Release note (sql change): This change teaches CRDB to apply zone
configs to new unique constraints in REGIONAL BY ROW tables.

Release note (sql change): Fix-up ALTER TABLE ... ADD CONSTRAINT ...
UNIQUE to partition correctly under a PARTITION ALL BY table.
Release note (sql change): This change teaches CRDB to apply zone
configs to new unique constraints in REGIONAL BY ROW tables.
@otan otan requested review from ajstorm and a team January 24, 2021 22:19
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@ajstorm ajstorm left a comment

Choose a reason for hiding this comment

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

:lgtm:

Just one nit below.

Reviewed 2 of 2 files at r1, 2 of 2 files at r2.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @otan)


pkg/ccl/logictestccl/testdata/logic_test/regional_by_row, line 207 at r2 (raw file):


statement ok
ALTER TABLE regional_by_row_table ADD CONSTRAINT unique_b_a UNIQUE(b, a)

Nit: We're testing adding a unique constraint on ALTER. Can we also test adding one on CREATE?

@otan
Copy link
Contributor Author

otan commented Jan 26, 2021


pkg/ccl/logictestccl/testdata/logic_test/regional_by_row, line 207 at r2 (raw file):

Previously, ajstorm wrote…

Nit: We're testing adding a unique constraint on ALTER. Can we also test adding one on CREATE?

There already is one on (b)

@otan
Copy link
Contributor Author

otan commented Jan 26, 2021

thanks

bors r=ajstorm

@craig
Copy link
Contributor

craig bot commented Jan 26, 2021

Build succeeded:

@craig craig bot merged commit aaa44bd into cockroachdb:master Jan 26, 2021
Copy link
Collaborator

@ajstorm ajstorm left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @otan)


pkg/ccl/logictestccl/testdata/logic_test/regional_by_row, line 207 at r2 (raw file):

Previously, otan (Oliver Tan) wrote…

There already is one on (b)

Isn't there just a unique index on b? Are unique constraints and unique indexes handle identically under the covers?

@otan
Copy link
Contributor Author

otan commented Jan 26, 2021


pkg/ccl/logictestccl/testdata/logic_test/regional_by_row, line 207 at r2 (raw file):

Previously, ajstorm wrote…

Isn't there just a unique index on b? Are unique constraints and unique indexes handle identically under the covers?

in CRDB they are treated the same (as of writing)

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