1568
MariaDBERRORCommonPartitioningHIGH confidence

NULL value not allowed in VALUES LESS THAN

Production Risk

Low — the DDL fails; no table is created.

What this means

A NULL value was specified in a VALUES LESS THAN clause of a RANGE partition definition.

Why it happens
  1. 1Using NULL as a partition boundary in a RANGE partition.
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 (NULL)
);

expected output

ERROR 1568 (HY000): Cannot use NULL value in VALUES LESS THAN

Fix

Use MAXVALUE or a numeric constant

Use MAXVALUE or a numeric constant
CREATE TABLE t (id INT)
PARTITION BY RANGE(id) (
  PARTITION p0 VALUES LESS THAN (100),
  PARTITION p1 VALUES LESS THAN MAXVALUE
);

Why this works

RANGE partition boundaries must be integer constants or MAXVALUE, never NULL.

Sources
Official documentation ↗

MySQL 8.0 — 1568 ER_NULL_IN_VALUES_LESS_THAN

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

← All MariaDB errors