1505
MariaDBERRORNotablePartitioningHIGH confidence

For RANGE partitions each partition must be defined

Production Risk

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

What this means

ER_PARTITION_NOT_DEFINED_ERROR (1505, SQLSTATE HY000) is raised when a RANGE-partitioned table is created without explicitly defining partition boundaries.

Why it happens
  1. 1RANGE partitioning declared with PARTITIONS N but without explicit VALUES LESS THAN definitions
How to reproduce
trigger — this will error
trigger — this will error
CREATE TABLE t (id INT)
PARTITION BY RANGE(id) PARTITIONS 3;  -- No VALUES LESS THAN defined

expected output

ERROR 1505 (HY000): For RANGE partitions each partition must be defined

Fix

Define explicit partitions with VALUES LESS THAN

Define explicit partitions with VALUES LESS THAN
CREATE TABLE t (id INT)
PARTITION BY RANGE(id) (
  PARTITION p0 VALUES LESS THAN (100),
  PARTITION p1 VALUES LESS THAN (1000),
  PARTITION p2 VALUES LESS THAN MAXVALUE
);

Why this works

RANGE partitioning requires explicit partition definitions; unlike HASH/KEY, it cannot auto-generate boundaries.

Sources
Official documentation ↗

MySQL 8.0 — 1505 ER_PARTITION_NOT_DEFINED_ERROR

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

← All MariaDB errors