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

ddl: allow defining auto_random on composite primary key #38572

Closed
bb7133 opened this issue Oct 20, 2022 · 0 comments · Fixed by #38617
Closed

ddl: allow defining auto_random on composite primary key #38572

bb7133 opened this issue Oct 20, 2022 · 0 comments · Fixed by #38617
Assignees
Labels
affects-5.4 This bug affects 5.4.x versions. affects-6.1 sig/sql-infra SIG: SQL Infra type/enhancement The issue or PR belongs to an enhancement.

Comments

@bb7133
Copy link
Member

bb7133 commented Oct 20, 2022

Enhancement

For now, TiDB doesn't allow defining AUTO_RANDOM attribute on composite primary keys, even when the key is the clustered index:

mysql> create table log ( id bigint auto_random, b bigint, create_time datetime not null, primary key(id, create_time));
ERROR 8216 (HY000): Invalid auto random: column id is not the integer primary key, or the primary key is nonclustered

Sometimes defining a primary key is useful, for example, to match the requirement of partition keys, so we could relax this restriction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.4 This bug affects 5.4.x versions. affects-6.1 sig/sql-infra SIG: SQL Infra type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants