1263
MariaDBWARNINGNotableData ImportHIGH confidence
Column set to default: NULL supplied to NOT NULL column
Production Risk
Medium — rows are imported with unexpected default values; data may be incorrect.
What this means
ER_WARN_NULL_TO_NOTNULL (1263, SQLSTATE 22004) is a warning issued when a NULL value is assigned to a NOT NULL column during LOAD DATA INFILE. MySQL sets the column to its default value instead.
Why it happens
- 1Input file contains empty or NULL values for a NOT NULL column
- 2Strict mode is not enabled, so MySQL substitutes the default instead of rejecting the row
How to reproduce
trigger — this will error
trigger — this will error
LOAD DATA INFILE '/data/import.csv' INTO TABLE orders FIELDS TERMINATED BY ',' (id, customer_id, amount); -- If amount field is empty in row 7: -- Warning 1263: Column 'amount' set to default value; NULL supplied to NOT NULL column at row 7
expected output
Warning (Code 1263): Column 'amount' set to default value; NULL supplied to NOT NULL column at row 7
Fix
Clean the input data to remove NULL values
Clean the input data to remove NULL values
-- Preprocess the CSV to replace empty fields with 0 or appropriate defaults -- Or enable strict mode to reject rows with NULL in NOT NULL columns: SET SESSION sql_mode = 'STRICT_TRANS_TABLES';
Why this works
In strict mode, NULL in a NOT NULL column raises an error instead of silently using the default.
Sources
Official documentation ↗
MySQL 8.0 — 1263 ER_WARN_NULL_TO_NOTNULL
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev