3416
MySQLERRORNotablePartitioningHIGH confidence

Wrong value used in RANGE partition definition

Production Risk

Low — DDL fails; no table is created or modified.

How to reproduce
trigger — this will error
trigger — this will error
CREATE TABLE t (id INT) PARTITION BY RANGE(id) (PARTITION p1 VALUES LESS THAN (100), PARTITION p0 VALUES LESS THAN (50));

expected output

ERROR 3416 (HY000): VALUES LESS THAN value must be strictly increasing for each partition.

Fix

Order partitions with increasing values

Order partitions with increasing values
CREATE TABLE t (id INT) PARTITION BY RANGE(id) (PARTITION p0 VALUES LESS THAN (50), PARTITION p1 VALUES LESS THAN (100), PARTITION pmax VALUES LESS THAN MAXVALUE);

Why this works

Strictly increasing VALUES LESS THAN boundaries satisfy RANGE partitioning requirements.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3416 ER_WRONG_RANGE_VALUE

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

← All MySQL errors