sql: fix ALTER INDEX IF EXISTS for non-existing index#42797
Merged
craig[bot] merged 2 commits intocockroachdb:masterfrom Nov 27, 2019
Merged
sql: fix ALTER INDEX IF EXISTS for non-existing index#42797craig[bot] merged 2 commits intocockroachdb:masterfrom
craig[bot] merged 2 commits intocockroachdb:masterfrom
Conversation
Member
e079377 to
94b5e79
Compare
jordanlewis
approved these changes
Nov 26, 2019
Member
jordanlewis
left a comment
There was a problem hiding this comment.
Reviewed 3 of 3 files at r1.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @apantel)
apantel
reviewed
Nov 26, 2019
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 */) | |||
Contributor
There was a problem hiding this comment.
Could you accomplish the same thing by passing requireTable=false here?
Collaborator
Author
There was a problem hiding this comment.
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
apantel
reviewed
Nov 26, 2019
Contributor
apantel
left a comment
There was a problem hiding this comment.
LGTM
Reviewable status:
complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @apantel and @jordanlewis)
Collaborator
Author
|
thanks for the reviews! bors r+ |
Collaborator
Author
|
bors r- |
Collaborator
Author
|
bors r+ |
craig bot
pushed a commit
that referenced
this pull request
Nov 27, 2019
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 <rafi@cockroachlabs.com> Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com>
Contributor
Build succeeded |
This was referenced Nov 27, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.