-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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: fix ALTER INDEX IF EXISTS for non-existing index #42797
Conversation
e079377
to
94b5e79
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 3 files at r1.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @apantel)
pkg/sql/rename_index.go
Outdated
@@ -36,6 +36,10 @@ type renameIndexNode struct { | |||
func (p *planner) RenameIndex(ctx context.Context, n *tree.RenameIndex) (planNode, error) { | |||
_, tableDesc, err := expandMutableIndexName(ctx, p, n.Index, true /* requireTable */) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you accomplish the same thing by passing requireTable=false here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually ended up making this more similar to drop_index.go, and set requireTable=!n.IfExists
Previously, if ALTER INDEX IF EXISTS (AIIE) was used on an unqualified index name that did not match any index, the database would return an "index does not exist" error. Now, the statement succeeds, but does nothing. Release note (bug fix): ALTER INDEX IF EXISTS no longer fails when using an unqualified index name that does not match any existing index. Now it is a no-op.
Test edge cases around ambiguous, non-existing, and/or unqualified index names, to reach test parity with alter_index logic test. Release note: None
94b5e79
to
fa4cbe5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @apantel and @jordanlewis)
thanks for the reviews! bors r+ |
bors r- |
bors r+ |
42797: sql: fix ALTER INDEX IF EXISTS for non-existing index r=rafiss a=rafiss Previously, if ALTER INDEX IF EXISTS was used on an unqualified index name that did not match any index, the database would return an "index does not exist" error. Now, the statement succeeds, but does nothing. Also, test edge cases around ambiguous, non-existing, and/or unqualified index names, in both alter_index and drop_index logic tests. Fixes #42399 Release note (bug fix): ALTER INDEX IF EXISTS no longer fails when using an unqualified index name that does not match any existing index. Now it is a no-op. 42831: colexec: fix a bug with top K sort not handling K > 1024 r=yuzefovich a=yuzefovich Previously, top K sorter when emitting the data would copy always from the beginning of the stored vectors. This is incorrect behavior when K is greater than coldata.BatchSize(), and now this has been fixed. Fixes: #42816. Release note (bug fix): A bug with incorrect handling of Top K sort by the vectorized engine when K is greater than 1024 has been fixed. 42835: workload, roachtest: skip TPCH Q4 for vec on r=yuzefovich a=yuzefovich TPCH query 4 in some cases can hit a memory limit error, so we will skip it for now (until the disk spilling is put in place). Release note: None Co-authored-by: Rafi Shamim <[email protected]> Co-authored-by: Yahor Yuzefovich <[email protected]>
Build succeeded |
Previously, if ALTER INDEX IF EXISTS was used on an
unqualified index name that did not match any index, the database would
return an "index does not exist" error.
Now, the statement succeeds, but does nothing.
Also, test edge cases around ambiguous, non-existing, and/or unqualified
index names, in both alter_index and drop_index logic tests.
Fixes #42399
Release note (bug fix): ALTER INDEX IF EXISTS no longer fails
when using an unqualified index name that does not match any existing
index. Now it is a no-op.