3419
MySQLERRORNotablePartitioningHIGH confidence

Wrong number of subpartition data values

Production Risk

Low — DDL fails; no table is created.

How to reproduce
trigger — this will error
trigger — this will error
CREATE TABLE t (id INT, dt DATE) PARTITION BY RANGE(YEAR(dt)) SUBPARTITION BY HASH(id) SUBPARTITIONS 4 (PARTITION p0 VALUES LESS THAN (2020) (SUBPARTITION s0, SUBPARTITION s1));

expected output

ERROR 3419 (HY000): Wrong number of subpartition definitions.

Fix

Match subpartition count to SUBPARTITIONS clause

Match subpartition count to SUBPARTITIONS clause
CREATE TABLE t (id INT, dt DATE) PARTITION BY RANGE(YEAR(dt)) SUBPARTITION BY HASH(id) SUBPARTITIONS 2 (PARTITION p0 VALUES LESS THAN (2020) (SUBPARTITION s0, SUBPARTITION s1));

Why this works

SUBPARTITIONS 2 matches the two explicitly named subpartitions s0 and s1.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3419 ER_PARTITION_WRONG_NO_SUBPART_DATA

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

← All MySQL errors