-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql:
ALTER PRIMARY KEY
rewrite secondary index if newPK subsets oldPK
Previously, during a `ALTER PRIMARY KEY`, if the new PK columns is a subset of the old PK columns, we won't rewrite existing unique, secondary index. This was inadequate because the user might think this column is not used anywhere and will want to drop it, which will unexpectedly drop the dependent unique index. Release note (bug fix): This PR fixed a bug where, in a `ALTER PRIMARY KEY`, if the new PK columns is a subset of the old PK columns, we will not rewrite existing secondary index, and hence those secondary indexes continue to have some of the old PK columns in their `suffixColumns`. But the user might, reasonably, think those columns are not used anymore and proceed to drop them. The bug then caused those dependent secondary indexes to be dropped, unexpectedly for the user. Release justification: fixed a bug where unique indexes will be silently dropped after `ALTER PRIMARY KEY` followed by `DROP COLUMN`.
- Loading branch information
Showing
2 changed files
with
83 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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