3080
MySQLERRORNotableData IntegrityHIGH confidence

Data value is out of range for the column

Production Risk

Medium — the INSERT/UPDATE fails and the row is not written.

What this means

A value being written to a column is outside the valid range for that column's data type.

Why it happens
  1. 1Inserting a number larger than the column type allows (e.g., 300 into a TINYINT UNSIGNED which allows 0-255).
  2. 2Arithmetic overflow in an expression.
How to reproduce
trigger — this will error
trigger — this will error
INSERT INTO t (tiny_col) VALUES (300);

expected output

ERROR 3080 (22003): Out of range value for column 'tiny_col' at row 1

Fix 1

Use an appropriate data type for the expected range

Use an appropriate data type for the expected range
ALTER TABLE t MODIFY tiny_col SMALLINT UNSIGNED;

Why this works

Widens the column type to accommodate larger values.

Fix 2

Validate input values before inserting

Validate input values before inserting
-- Application-level range check before executing INSERT

Why this works

Prevents out-of-range values from reaching the database.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3080 ER_DATA_OUT_OF_RANGE2

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

← All MySQL errors