1427
MariaDBerrorddlhigh confidence

For DECIMAL(M,D), M must be >= D

Production Risk

Low — DDL fails; no data affected.

What this means

In a DECIMAL(M,D), FLOAT(M,D), or DOUBLE(M,D) declaration, the scale D is greater than the precision M.

Why it happens
  1. 1DECIMAL(5, 10) — scale 10 exceeds precision 5
  2. 2Typo in column definition
How to reproduce
trigger — this will error
trigger — this will error
CREATE TABLE t (price DECIMAL(5, 10));

expected output

ERROR 1427 (42000): For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'price')

Fix

Ensure M >= D

Ensure M >= D
CREATE TABLE t (price DECIMAL(12, 4));

Why this works

Precision must accommodate all digits including the scale.

Sources
Official documentation ↗

MySQL 8.0 — 1427 ER_M_BIGGER_THAN_D

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

← All MariaDB errors