1261
MariaDBWARNINGCriticalData ImportHIGH confidence
Row truncated: fewer input columns than table columns
Production Risk
Low — rows are imported with default values; review data for correctness.
What this means
ER_WARN_TOO_FEW_RECORDS (1261, SQLSTATE 01000) is a warning issued during LOAD DATA INFILE when a row in the input file has fewer columns than the target table. Missing columns are set to their default values.
Why it happens
- 1Input file has fewer fields per row than the table has columns
- 2Column delimiter mismatch causing incorrect field parsing
How to reproduce
trigger — this will error
trigger — this will error
LOAD DATA INFILE '/data/import.csv' INTO TABLE products FIELDS TERMINATED BY ',' (id, name, price); -- If CSV row has only 2 fields, warning 1261 is issued
expected output
Warning (Code 1261): Row 5 was truncated; it contained less data than there were input columns
Fix
Fix the input file to include all required columns
Fix the input file to include all required columns
-- Ensure each row in the CSV has all required fields -- Or specify only the columns present in the file: LOAD DATA INFILE '/data/import.csv' INTO TABLE products FIELDS TERMINATED BY ',' (id, name); -- match actual columns in file
Why this works
Explicitly listing only the columns present in the file prevents the mismatch.
Sources
Official documentation ↗
MySQL 8.0 — 1261 ER_WARN_TOO_FEW_RECORDS
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev