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

Closed
time-and-fate opened this issue Sep 14, 2024 · 0 comments · Fixed by #56197
Closed

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

time-and-fate opened this issue Sep 14, 2024 · 0 comments · Fixed by #56197
Assignees
Labels
affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. component/tablepartition This issue is related to Table Partition of TiDB. 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
affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. component/tablepartition This issue is related to Table Partition of TiDB. severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants