Skip to content

alter table t partitioning with unique index which not include partition columns should be forbiden #51634

@jiyfhust

Description

@jiyfhust

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop table if exists t;
create table t(a int, b int, unique idx_b(b));
alter table t partition by hash(a) partitions 3;
insert into t values (1,1), (2,1), (3, 1);

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

return error.

3. What did you see instead (Required)

mysql> drop table t;
Query OK, 0 rows affected (0.28 sec)

mysql> drop table if exists t;
Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql> create table t(a int, b int, unique idx_b(b));
alter table t partition by hash(a) partitions 3;Query OK, 0 rows affected (0.12 sec)

mysql> alter table t partition by hash(a) partitions 3;
Query OK, 0 rows affected, 1 warning (2.02 sec)

mysql>  insert into t values (1,1), (2,1), (3, 1);
Query OK, 3 rows affected (0.01 sec)
Records: 3  Duplicates: 0  Warnings: 0

mysql> select b from t;
+------+
| b    |
+------+
|    1 |
|    1 |
|    1 |
+------+
3 rows in set (0.00 sec)

4. What is your TiDB version? (Required)

master

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions