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

restrictions on partitioning in CREATE TABLE can be bypass with ALTER TABLE #56094

Open
time-and-fate opened this issue Sep 14, 2024 · 0 comments
Labels
component/tablepartition This issue is related to Table Partition of TiDB. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 may-affects-8.1 severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@time-and-fate
Copy link
Member

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t(a varchar(20), b int) partition by hash(a) partitions 2; -- fail
create table t(a varchar(20), b int);
alter table t partition by hash(a) partitions 2; -- success

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

Both succeed or both fail.

3. What did you see instead (Required)

> create table t(a varchar(20), b int) partition by hash(a) partitions 2;
ERROR 1659 (HY000): Field 'a' is of a not allowed type for this type of partitioning
> create table t(a varchar(20), b int);
Query OK, 0 rows affected (0.045 sec)

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

> show create table t;
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                                                                   |
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| t     | CREATE TABLE `t` (
  `a` varchar(20) DEFAULT NULL,
  `b` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
PARTITION BY HASH (`a`) PARTITIONS 2 |
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.001 sec)

4. What is your TiDB version? (Required)

nightly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/tablepartition This issue is related to Table Partition of TiDB. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 may-affects-8.1 severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

2 participants