3417
MySQLERRORNotablePartitioningHIGH confidence
Wrong default partition for column value
Production Risk
Low — DDL fails; no table is created.
How to reproduce
trigger — this will error
trigger — this will error
CREATE TABLE t (dt DATE) PARTITION BY RANGE COLUMNS(dt) (PARTITION p0 VALUES LESS THAN ('not-a-date'));expected output
ERROR 3417 (HY000): Wrong partition value for column.
Fix
Use type-compatible values in COLUMNS partitioning
Use type-compatible values in COLUMNS partitioning
CREATE TABLE t (dt DATE) PARTITION BY RANGE COLUMNS(dt) (PARTITION p0 VALUES LESS THAN ('2024-01-01'), PARTITION p1 VALUES LESS THAN (MAXVALUE));Why this works
Date literals in YYYY-MM-DD format are type-compatible with DATE columns.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 3417 ER_WRONG_DEFAULT_PARTITION_FOR_COLUMN
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev