1524
MySQLERRORNotablePartitioningHIGH confidence
Duplicate partition name
Production Risk
Low — DDL error; the table will not be created.
What this means
ER_SAME_NAME_PARTITION (1524, SQLSTATE HY000) is raised when a partition definition uses a name that is already used by another partition in the same table.
Why it happens
- 1Two or more partitions defined with the same name in CREATE TABLE or ALTER TABLE
- 2Adding a partition with a name that already exists
How to reproduce
trigger — this will error
trigger — this will error
CREATE TABLE t (id INT) PARTITION BY RANGE(id) ( PARTITION p0 VALUES LESS THAN (100), PARTITION p0 VALUES LESS THAN (200) -- Duplicate name );
expected output
ERROR 1524 (HY000): Duplicate partition name p0
Fix
Use unique names for each partition
Use unique names for each partition
CREATE TABLE t (id INT) PARTITION BY RANGE(id) ( PARTITION p0 VALUES LESS THAN (100), PARTITION p1 VALUES LESS THAN (200), PARTITION p2 VALUES LESS THAN MAXVALUE );
Why this works
Each partition in a table must have a unique name.
Sources
Official documentation ↗
MySQL 8.0 — 1524 ER_SAME_NAME_PARTITION
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev