1264WARNINGTier 2 — Caution✅ HIGH confidence

Out of range value for column

Category: Data TruncationVersions: All MariaDB / MySQL versions

What this means

Error/warning 1264 (SQLSTATE 22003) is issued when a value being inserted or updated exceeds the valid range for the column's declared data type. In strict SQL mode this is an error that aborts the statement. In non-strict mode it is a warning and the out-of-range value is silently truncated to the column's maximum or minimum value.

Why it happens

  1. 1Inserting a value larger than TINYINT UNSIGNED (255) or INT (2147483647) etc.
  2. 2Inserting a negative value into an UNSIGNED integer column
  3. 3Arithmetic overflow in a computed column value

How to reproduce

A value exceeding TINYINT UNSIGNED range is inserted with strict mode on.

trigger — this will ERROR
SET sql_mode = 'STRICT_TRANS_TABLES';
CREATE TABLE config (id INT PRIMARY KEY, score TINYINT UNSIGNED);
INSERT INTO config VALUES (1, 300);  -- TINYINT UNSIGNED max is 255
ERROR 1264 (22003): Out of range value for column 'score' at row 1

Fix 1: Use an appropriate column data type for the expected value range

When the column type is too small for the actual data.

fix
ALTER TABLE config MODIFY score SMALLINT UNSIGNED;  -- max 65535
-- or:
ALTER TABLE config MODIFY score INT UNSIGNED;       -- max 4294967295

Why this works

Choosing a data type whose range encompasses the actual data values eliminates the overflow. Review the MariaDB integer type range table to pick the smallest type that fits the expected maximum value.

What not to do

Disable strict mode so values are silently clamped

Why it's wrong: Non-strict mode silently truncates 300 to 255 without an error. The stored value is wrong and there is no indication in the application that the data was changed.

Version notes

MariaDB 10.2+STRICT_TRANS_TABLES is enabled by default in sql_mode. Behaviour differs from older MySQL 5.x defaults where non-strict was common.

Sources

📚 Official docs: https://mariadb.com/kb/en/data-type-storage-requirements/

🔧 Source ref: MariaDB Server error code 1264 / ER_WARN_DATA_OUT_OF_RANGE

📖 Further reading: MariaDB integer types

Confidence assessment

✅ HIGH confidence

Stable. Numeric range limits are part of the SQL standard and consistent across versions.

See also

📄 Reference pages

MariaDB integer typesstrict SQL mode
⚙️ This error reference was generated with AI assistance and reviewed for accuracy. Examples are provided to illustrate common scenarios and may not cover every case. Always test fixes in a development environment before applying to production. Spotted an error? Suggest a correction →