diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index f2a105827da..c1f3041bf12 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -30,3 +30,27 @@ create table if not exists t1(id int); select @@warning_count; @@warning_count 0 +drop table t1; +create table t1(a tinyint, b int not null, c date, d char(5)); +load data infile '../../std_data/warnings_loaddata.dat' into table t1 fields terminated by ','; +Warnings: +Warning 1262 Data truncated, NULL supplied to NOT NULL column 'b' at row 2 +Warning 1261 Data truncated for column 'd' at row 3 +Warning 1261 Data truncated for column 'c' at row 4 +Warning 1259 Value count is fewer than the column count at row 5 +Warning 1261 Data truncated for column 'b' at row 6 +Warning 1260 Value count is more than the column count at row 7 +Warning 1261 Data truncated for column 'a' at row 8 +select @@warning_count; +@@warning_count +7 +show warnings; +Level Code Message +Warning 1262 Data truncated, NULL supplied to NOT NULL column 'b' at row 2 +Warning 1261 Data truncated for column 'd' at row 3 +Warning 1261 Data truncated for column 'c' at row 4 +Warning 1259 Value count is fewer than the column count at row 5 +Warning 1261 Data truncated for column 'b' at row 6 +Warning 1260 Value count is more than the column count at row 7 +Warning 1261 Data truncated for column 'a' at row 8 +drop table t1; diff --git a/mysql-test/std_data/warnings_loaddata.dat b/mysql-test/std_data/warnings_loaddata.dat new file mode 100644 index 00000000000..e645de775ab --- /dev/null +++ b/mysql-test/std_data/warnings_loaddata.dat @@ -0,0 +1,8 @@ +10,20,2003-04-21,mysql +20,\N,2003-04-22,MySQL +30,40,2003-04-23,MySQL is Open Source Database +40,50,monty,30 +50,60,2003-04-24 +60,67 abc,2003-04-25,mysql +70,80,2003-04-26,mysql,open,source +500,90,2003-04-27,mysql diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test index 8cff8706c43..bfdbb8f025a 100644 --- a/mysql-test/t/warnings.test +++ b/mysql-test/t/warnings.test @@ -17,6 +17,7 @@ set SQL_WARNINGS=0; # # Test other warnings +# drop temporary table if exists not_exists; drop table if exists not_exists_table; @@ -26,3 +27,14 @@ show count(*) warnings; create table t1(id int); create table if not exists t1(id int); select @@warning_count; +drop table t1; + +# +# Test warnings for LOAD DATA INFILE +# + +create table t1(a tinyint, b int not null, c date, d char(5)); +load data infile '../../std_data/warnings_loaddata.dat' into table t1 fields terminated by ','; +select @@warning_count; +show warnings; +drop table t1;