1526
MySQLERRORNotablePartitioningHIGH confidence
Partitions to reorganize must be consecutive
Production Risk
Low — the ALTER TABLE fails; no data is affected.
What this means
ER_CONSECUTIVE_REORG_PARTITIONS (1526, SQLSTATE HY000) is raised when REORGANIZE PARTITION lists partitions that are not consecutive in the partition order.
Why it happens
- 1REORGANIZE PARTITION specifying non-adjacent partitions
- 2Skipping partitions in the REORGANIZE list
How to reproduce
trigger — this will error
trigger — this will error
ALTER TABLE t REORGANIZE PARTITION p0, p2 INTO ( PARTITION pnew VALUES LESS THAN (300) ); -- p0 and p2 are not consecutive (p1 is between them)
expected output
ERROR 1526 (HY000): When reorganizing a set of partitions they must be consecutive
Fix
Include all consecutive partitions in the REORGANIZE
Include all consecutive partitions in the REORGANIZE
ALTER TABLE t REORGANIZE PARTITION p0, p1, p2 INTO ( PARTITION pnew VALUES LESS THAN (300) );
Why this works
REORGANIZE PARTITION requires that all listed partitions are adjacent in the partition sequence.
Sources
Official documentation ↗
MySQL 8.0 — 1526 ER_CONSECUTIVE_REORG_PARTITIONS
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev