1527
MariaDBERRORNotablePartitioningHIGH confidence

REORGANIZE PARTITION cannot change total RANGE except at last partition

Production Risk

Low — the ALTER TABLE fails; review the target boundary values.

What this means

ER_REORG_OUTSIDE_RANGE (1527, SQLSTATE HY000) is raised when REORGANIZE PARTITION attempts to change the overall data range of a RANGE-partitioned table, which is only allowed at the last partition.

Why it happens
  1. 1REORGANIZE creating new partition boundaries that extend beyond the original range in a non-terminal partition
  2. 2Reducing the total covered range during reorganization
How to reproduce
trigger — this will error
trigger — this will error
ALTER TABLE t REORGANIZE PARTITION p0 INTO (
  PARTITION pa VALUES LESS THAN (50),
  PARTITION pb VALUES LESS THAN (200)  -- Extends beyond original p0 boundary
);

expected output

ERROR 1527 (HY000): Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range

Fix

Only extend the range at the last partition

Only extend the range at the last partition
-- Only the last partition can have its upper bound extended:
ALTER TABLE t REORGANIZE PARTITION plast INTO (
  PARTITION plast_new VALUES LESS THAN (5000),
  PARTITION p_future VALUES LESS THAN MAXVALUE
);

Why this works

For non-terminal partitions, the new boundaries must cover exactly the same range as the original partitions.

Sources
Official documentation ↗

MySQL 8.0 — 1527 ER_REORG_OUTSIDE_RANGE

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MariaDB errors