1264WARNINGTier 2 — Caution✅ HIGH confidenceOut of range value for column
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
- 1Inserting a value larger than TINYINT UNSIGNED (255) or INT (2147483647) etc.
- 2Inserting a negative value into an UNSIGNED integer column
- 3Arithmetic overflow in a computed column value
How to reproduce
A value exceeding TINYINT UNSIGNED range is inserted with strict mode on.
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 255Fix 1: Use an appropriate column data type for the expected value range
When the column type is too small for the actual data.
ALTER TABLE config MODIFY score SMALLINT UNSIGNED; -- max 65535
-- or:
ALTER TABLE config MODIFY score INT UNSIGNED; -- max 4294967295Why 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