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: Mistakenly disallow UNIQUE WITHOUT INDEX NOT VALID in CREATE TABLE stmt #115352

Closed
Xiang-Gu opened this issue Nov 30, 2023 · 1 comment · Fixed by #115354
Closed

sql: Mistakenly disallow UNIQUE WITHOUT INDEX NOT VALID in CREATE TABLE stmt #115352

Xiang-Gu opened this issue Nov 30, 2023 · 1 comment · Fixed by #115354
Assignees
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. db-cy-23 docs-known-limitation O-schema-testing Originated from SQL Schema testing strategies T-sql-queries SQL Queries Team

Comments

@Xiang-Gu
Copy link
Contributor

Xiang-Gu commented Nov 30, 2023

We can add a not valid unique-without-index constraint to a table via ADD UNIQUE WITHOUT INDEX (cols) NOT VALID, but we disallow creating a table with a not valid unique-without-index constraint.

This is because commit 8dd20ad disallowed add not valid primary and unique constraint (with the intention of index-backed-unique constraint). Unique-without-index is not backed by any index and we should allow it. Just like any other not valid constraint (e.g. check, FK) in create table in that same commit, the NOT VALID part will be dropped and is treated as a normal unique-without-index.

Jira issue: CRDB-33992

Epic CRDB-30346

@Xiang-Gu Xiang-Gu added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-queries SQL Queries Team db-cy-23 O-schema-testing Originated from SQL Schema testing strategies labels Nov 30, 2023
@Xiang-Gu Xiang-Gu self-assigned this Nov 30, 2023
@github-project-automation github-project-automation bot moved this to Triage in SQL Queries Nov 30, 2023
@Xiang-Gu
Copy link
Contributor Author

I don't think we want to backport the fix to 23.2 so I'm tagging it as a docs-known-limitation issue.

@craig craig bot closed this as completed in eb4a916 Dec 7, 2023
@github-project-automation github-project-automation bot moved this from Triage to Done in SQL Queries Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. db-cy-23 docs-known-limitation O-schema-testing Originated from SQL Schema testing strategies T-sql-queries SQL Queries Team
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant