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

create unique index without partition column error when enable-global-index is true #21731

Closed
crazycs520 opened this issue Dec 14, 2020 · 1 comment · Fixed by #22471
Closed
Assignees
Labels
sig/execution SIG execution

Comments

@crazycs520
Copy link
Contributor

crazycs520 commented Dec 14, 2020

Development Task

Please answer these questions before submitting your issue. Thanks!

related issue: #18032

1. Minimal reproduce step (Required)

TiDB config:

enable-global-index=true
create table t (a int, b int, unique index idx(a)) partition by list columns(b) (partition p0 values in (1), partition p1 values in (2));

2. What did you expect to see? (Required)

Execute success.

Currently, create table without unique index, but alter table add unique index later will be success.

test> create table t (a int, b int) partition by list columns(b) (partition p0 values in (1), partition p1 values in (2));
Query OK, 0 rows affected
Time: 0.098s
test> alter table t add unique index idx (a);
Query OK, 0 rows affected
Time: 2.818s

3. What did you see instead (Required)

test> create table t (a int, b int, unique index idx(a)) partition by list columns(b) (partition p0 values in (1), partition p1 values in (2));
(1503, "A UNIQUE INDEX must include all columns in the table's partitioning function")

4. What is your TiDB version? (Required)

> select tidb_version();
+-------------------------------------------------------------------+
| tidb_version()                                                    |
+-------------------------------------------------------------------+
| Release Version: v4.0.0-beta.2-1812-gd33b81b1e                    |
| Edition: Community                                                |
| Git Commit Hash: d33b81b1ee69bd60a56e45f87774e76014720a6e         |
| Git Branch: master                                                |
| UTC Build Time: 2020-12-14 12:59:19                               |
| GoVersion: go1.14.4                                               |
| Race Enabled: false                                               |
| TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306 |
| Check Table Before Drop: false                                    |
+-------------------------------------------------------------------+
@crazycs520 crazycs520 added the type/bug The issue is confirmed as a bug. label Dec 14, 2020
@crazycs520
Copy link
Contributor Author

@tiancaiamao PTAL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution
Projects
None yet
3 participants