1265WARNINGTier 1 — Safe✅ HIGH confidenceData truncated for column
🔴 Production Risk Error
HIGH — silent data corruption if warnings are not checked.
What this means
Warning (or error in strict mode) 1265 is generated when a value being inserted or updated is silently truncated to fit the column definition — for example, a string too long for an ENUM, a decimal with too many fractional digits, or a value outside an integer range. In strict SQL mode this becomes a hard error.
Why it happens
- 1Inserting a string value into an ENUM column that does not match any ENUM member
- 2Inserting a DECIMAL value with more fractional digits than the column definition allows
- 3Inserting a value into a SET column that is not a recognised member
- 4String value exceeds column length when strict mode is off (truncated silently)
How to reproduce
Inserting an invalid ENUM value with strict mode disabled.
INSERT INTO orders (status) VALUES ('shipped_today');
-- status is ENUM('pending', 'shipped', 'delivered')Fix 1: Enable strict SQL mode to make truncation a hard error
In all production environments — strict mode prevents silent data corruption.
SET SESSION sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO';
-- Or permanently in my.cnf:
-- sql_mode = STRICT_TRANS_TABLES,...Why this works
STRICT_TRANS_TABLES causes data truncation to raise an error rather than a warning, forcing the application to send valid data.
Fix 2: Fix the source data to match the column definition
When the value being inserted is incorrect.
-- Map to a valid ENUM value before inserting:
INSERT INTO orders (status) VALUES ('shipped');
-- Or extend the ENUM to include the new value:
ALTER TABLE orders MODIFY status ENUM('pending', 'shipped', 'shipped_today', 'delivered');Why this works
Extending the ENUM is preferred when the new value is intentional; mapping is preferred when the source data has a bug.
What not to do
Ignore 1265 warnings in non-strict mode
Why it's wrong: Silent truncation leads to corrupted data that is difficult to detect and correct later.
Version notes
MariaDB 10.2.4+Strict mode is enabled by default in new installations.Sources
📚 Official docs: https://mariadb.com/kb/en/sql-mode/#strict-mode
🔧 Source ref: MariaDB Server error code 1265 / WARN_DATA_TRUNCATED
📖 Further reading: MariaDB SQL Modes
📖 Further reading: MariaDB ENUM
Confidence assessment
✅ HIGH confidence
Stable.
See also
🔗 Related errors
📄 Reference pages