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

*: Properly support partial UNIQUE WITHOUT INDEX referencing type descs #96681

Merged
merged 1 commit into from
Feb 7, 2023

Conversation

Xiang-Gu
Copy link
Contributor

@Xiang-Gu Xiang-Gu commented Feb 6, 2023

Previously if a partial UNIQUE WITHOUT INDEX references a type descriptor in its predicate, we didn't add back-references in the type descriptor, both in the legacy and declarative schema changer. This commit fixes this.

Fixes #96678
Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@Xiang-Gu Xiang-Gu force-pushed the uwi_support_ref_to_descs branch 2 times, most recently from a5b2274 to d5b662e Compare February 6, 2023 20:59
@Xiang-Gu Xiang-Gu marked this pull request as ready for review February 6, 2023 22:04
@Xiang-Gu Xiang-Gu requested a review from a team February 6, 2023 22:04
Copy link
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: mod the testing request

Reviewed 3 of 4 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @Xiang-Gu)


pkg/sql/unique_without_index_test.go line 53 at r1 (raw file):

		tdb.Exec(t, "CREATE TYPE typ AS ENUM ('a', 'b');")
		tdb.Exec(t, "CREATE TABLE t (i INT PRIMARY KEY, j STRING);")
		tdb.Exec(t, "ALTER TABLE t ADD UNIQUE WITHOUT INDEX (j) WHERE (j::typ != 'a');")

Can you ensure that dropping the enum member fails because it's referenced by the constraint? Then ensure that it succeeds after you drop the constraint?

Copy link
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.

Should this have a release note?

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

@Xiang-Gu Xiang-Gu force-pushed the uwi_support_ref_to_descs branch from d5b662e to 7189289 Compare February 7, 2023 15:35
Copy link
Contributor Author

@Xiang-Gu Xiang-Gu left a comment

Choose a reason for hiding this comment

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

I intentionally didn't put one because this feature UNIQUE WITHOUT INDEX is hidden from users (both in code and in doc).

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

Previously if a partial UNIQUE WITHOUT INDEX references a type
descriptor in its predicate, we didn't add back-references in the
type descriptor, both in the legacy and declarative schema changer.
This commit fixes this.

Release note: None
@Xiang-Gu Xiang-Gu force-pushed the uwi_support_ref_to_descs branch from 7189289 to f113af3 Compare February 7, 2023 15:36
@Xiang-Gu
Copy link
Contributor Author

Xiang-Gu commented Feb 7, 2023

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Feb 7, 2023

Build succeeded:

@craig craig bot merged commit f640acb into cockroachdb:master Feb 7, 2023
@Xiang-Gu Xiang-Gu deleted the uwi_support_ref_to_descs branch February 7, 2023 18: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.

Support partial UniqueWithoutIndex referencing types
3 participants