3087
MySQLERRORNotablePartitioningHIGH confidence
RANGE/LIST partition values must be integers
Production Risk
Low — DDL fails; no table is created.
What this means
PARTITION BY RANGE or LIST requires integer expression values, but a non-integer value was provided.
Why it happens
- 1Using a string or float value in PARTITION BY RANGE VALUES LESS THAN.
- 2Using RANGE with a non-integer partition key without RANGE COLUMNS.
How to reproduce
trigger — this will error
trigger — this will error
CREATE TABLE t (dt DATE) PARTITION BY RANGE (dt) (PARTITION p0 VALUES LESS THAN ('2024-01-01'));expected output
ERROR 3087 (HY000): VALUES value must be of the same type as partition function.
Fix
Use RANGE COLUMNS for non-integer partition keys
Use RANGE COLUMNS for non-integer partition keys
CREATE TABLE t (dt DATE) PARTITION BY RANGE COLUMNS (dt) (PARTITION p0 VALUES LESS THAN ('2024-01-01'));Why this works
RANGE COLUMNS supports non-integer column types.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 3087 ER_VALUES_IS_NOT_INT_TYPE_ERROR2
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev