Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
Branch Name
HEAD (detached at task workspace)
Commit ID
ff2acc1ace1a4b8a37dde011a9aa529ff2286c30
Other Environment Information
- Hardware parameters: Apple Silicon, darwin/arm64
- OS type: macOS 15.5 (24F74)
- Others: standalone
mo-servicebuilt from the above commit, frontend port26201; MySQL 8.0.46 control instance on port23506
Actual Behavior
With the default session SQL mode, explicitly empty CSV fields imported through LOAD DATA LOCAL INFILE are stored as SQL NULL:
MatrixOne, empty INT:
id n
1 NULL
2 7
MatrixOne, empty DATE:
id dt
1 NULL
2 2024-02-29
Expected Behavior
MySQL 8.0.46 converts the same explicit empty text to the zero values for these column families:
MySQL 8.0.46, empty INT:
id n
1 0
2 7
MySQL 8.0.46, empty DATE:
id dt
1 0000-00-00
2 2024-02-29
Steps to Reproduce
Create these local files:
/tmp/repro_empty_int.csv
id,n
1,
2,7
/tmp/repro_empty_date.csv
id,dt
1,
2,2024-02-29
Then run:
drop database if exists loom_repro;
create database loom_repro;
use loom_repro;
create table ti(id int primary key, n int);
create table td(id int primary key, dt date);
load data local infile '/tmp/repro_empty_int.csv' into table ti
fields terminated by ',' lines terminated by '\n' ignore 1 lines;
load data local infile '/tmp/repro_empty_date.csv' into table td
fields terminated by ',' lines terminated by '\n' ignore 1 lines;
select * from ti order by id;
select * from td order by id;No SET sql_mode is used; both systems use their default session mode.
Additional information
shouldApplyLoadDataNonStrictAdjustments only enables the special LOCAL CSV conversion path when !param.StrictSqlMode (pkg/sql/colexec/external/external.go:1492). In the default strict session, getColData therefore treats the empty non-string value as NULL at pkg/sql/colexec/external/external.go:1927. This conflates “LOCAL” with “non-strict”: MySQL's LOCAL path still supplies the empty-text zero values in this setup.
Issue #25366 covers non-strict LOCAL conversion of invalid non-empty text; this report is narrower to explicit empty text in a default strict LOCAL load. The old timestamp-empty crash in #5571 is a different failure mode.
Full reproduction, exactly as Loom ran it
printf '%s\n' 'id,n' '1,' '2,7' > /tmp/repro_empty_int.csv
printf '%s\n' 'id,dt' '1,' '2,2024-02-29' > /tmp/repro_empty_date.csv
mysql --local-infile=1 -h 127.0.0.1 -P 26201 -u root -p111 --force -e "drop database if exists loom_repro; create database loom_repro; use loom_repro; create table ti(id int primary key, n int); create table td(id int primary key, dt date); load data local infile '/tmp/repro_empty_int.csv' into table ti fields terminated by ',' lines terminated by '\n' ignore 1 lines; load data local infile '/tmp/repro_empty_date.csv' into table td fields terminated by ',' lines terminated by '\n' ignore 1 lines; select * from ti order by id; select * from td order by id"Found by Loom bug hunt (module: custom-a9872c7d6e; tests: unit, white-box, end-to-end)
Activity
XuPeng-SH commentedon Oct 22, 2026
This report is now tracked together with #30499. The canonical issue retains explicit acceptance cases for the behavior described here. This is an administrative duplicate/consolidation closure only; the underlying defect is not claimed fixed. The original description and discussion remain available on this issue.