1500
MySQLERRORNotablePartitioningHIGH confidence

VALUES value must be of same type as partition function

Production Risk

Low — DDL error; the table will not be created.

What this means

ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR (1500, SQLSTATE HY000) is raised when the VALUES LESS THAN or VALUES IN value is of a different type than the partition function expression.

Why it happens
  1. 1Using a string value in VALUES LESS THAN for an integer partition function
  2. 2Type mismatch between the partition expression and the boundary values
How to reproduce
trigger — this will error
trigger — this will error
CREATE TABLE t (id INT)
PARTITION BY RANGE(id) (
  PARTITION p0 VALUES LESS THAN ('high')  -- String in integer range
);

expected output

ERROR 1500 (HY000): VALUES value must be of same type as partition function

Fix

Use values matching the partition function type

Use values matching the partition function type
CREATE TABLE t (id INT)
PARTITION BY RANGE(id) (
  PARTITION p0 VALUES LESS THAN (1000),
  PARTITION p1 VALUES LESS THAN MAXVALUE
);

Why this works

The boundary values in VALUES clauses must match the data type of the partition function expression.

Sources
Official documentation ↗

MySQL 8.0 — 1500 ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR

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

← All MySQL errors