*: use CLUSTERED and NONCLUSTERED to control primary key type#22409
*: use CLUSTERED and NONCLUSTERED to control primary key type#22409ti-srebot merged 13 commits intopingcap:masterfrom
Conversation
|
No release note, Please follow https://github.com/pingcap/community/blob/master/contributors/release-note-checker.md |
e06eb40 to
eda4d82
Compare
|
No release note, Please follow https://github.com/pingcap/community/blob/master/contributors/release-note-checker.md |
2 similar comments
|
No release note, Please follow https://github.com/pingcap/community/blob/master/contributors/release-note-checker.md |
|
No release note, Please follow https://github.com/pingcap/community/blob/master/contributors/release-note-checker.md |
bdc313b to
46fad2f
Compare
46fad2f to
34fb11a
Compare
| } | ||
| case model.PrimaryKeyTypeDefault: | ||
| if isSingleIntPK(constr, lastCol) { | ||
| tbInfo.PKIsHandle = !alterPKConf |
There was a problem hiding this comment.
Add && ctx.GetSessionVars().EnableClusteredIndex either to make it consistent with common handle?
There was a problem hiding this comment.
A lot of tests will be broken. Let's do this in another PR when it is decided.
|
Please fix CI. |
|
LGTM |
| if isSingleIntPK(constr, lastCol) { | ||
| tbInfo.PKIsHandle = !alterPKConf | ||
| } else { | ||
| tbInfo.IsCommonHandle = !alterPKConf && ctx.GetSessionVars().EnableClusteredIndex |
There was a problem hiding this comment.
Shall we return a warning if model.PrimaryKeyTypeClustered && !ctx.GetSessionVars().EnableClusteredIndex?
There was a problem hiding this comment.
No, the variable has lower priority.
|
LGTM |
|
/merge |
|
/run-all-tests |
|
@tangenta merge failed. |
|
/run-common-test tidb-test=pr/1161 |
/run-integration-ddl-test |
|
/merge |
|
/merge |
|
/run-all-tests |
|
@tangenta merge failed. |
|
/run-all-tests |
What problem does this PR solve?
Issue Number: close #22346
Problem Summary:
As mentioned in #22346, it is not intuitive to set the session variable before creating a table. What’s more, it is also inconvenient to change the variable back and forth in the case of mix usage.
What is changed and how it works?
What's Changed:
CLUSTEREDandNONCLUSTEREDkeywords).tidb_enable_clustered_indexand the config optionalter-primary-key./*!T[clustered_index] xxx */is added in the output from binlog andSHOW CREATE TABLE.tidb_pk_typeininformation_schema.tablesto{CLUSTERED, NON_CLUSTERED}.Related changes
pingcap/docs/pingcap/docs-cn:Check List
Tests
Side effects
N/A
Release note
CLUSTEREDandNONCLUSTEREDkeywords to specify the primary key type inCREATE TABLEstatements.