From a1bd0bd1182d9acb6a8484e79259c2f80db042fd Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 2 Aug 2006 17:15:50 +0500 Subject: BUG#14770 - LOAD DATA INFILE doesn't respect default values for columns Fixed confusing warning. Quoting INSERT section of the manual: ---- Inserting NULL into a column that has been declared NOT NULL. For multiple-row INSERT statements or INSERT INTO ... SELECT statements, the column is set to the implicit default value for the column data type. This is 0 for numeric types, the empty string ('') for string types, and the "zero" value for date and time types. INSERT INTO ... SELECT statements are handled the same way as multiple-row inserts because the server does not examine the result set from the SELECT to see whether it returns a single row. (For a single-row INSERT, no warning occurs when NULL is inserted into a NOT NULL column. Instead, the statement fails with an error.) ---- This is also true for LOAD DATA INFILE. For INSERT user can specify DEFAULT keyword as a value to set column default. There is no similiar feature available for LOAD DATA INFILE. mysql-test/r/auto_increment.result: Fixed confusing warning. mysql-test/r/create.result: Fixed confusing warning. mysql-test/r/insert.result: Fixed confusing warning. mysql-test/r/insert_select.result: Fixed confusing warning. mysql-test/r/key.result: Fixed confusing warning. mysql-test/r/null.result: Fixed confusing warning. mysql-test/r/null_key.result: Fixed confusing warning. mysql-test/r/ps_2myisam.result: Fixed confusing warning. mysql-test/r/ps_3innodb.result: Fixed confusing warning. mysql-test/r/ps_4heap.result: Fixed confusing warning. mysql-test/r/ps_5merge.result: Fixed confusing warning. mysql-test/r/ps_6bdb.result: Fixed confusing warning. mysql-test/r/strict.result: Fixed confusing warning. mysql-test/r/view.result: Fixed confusing warning. mysql-test/r/warnings.result: Fixed confusing warning. sql/share/errmsg.txt: Fixed confusing warning. --- mysql-test/r/warnings.result | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'mysql-test/r/warnings.result') diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index f9006ebca37..2b1993bdd90 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -72,7 +72,7 @@ drop table t1; create table t1(a tinyint, b int not null, c date, d char(5)); load data infile '../std_data_ln/warnings_loaddata.dat' into table t1 fields terminated by ','; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'b' at row 2 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'b' at row 2 Warning 1265 Data truncated for column 'd' at row 3 Warning 1265 Data truncated for column 'c' at row 4 Warning 1261 Row 5 doesn't contain data for all columns @@ -86,7 +86,7 @@ drop table t1; create table t1(a tinyint NOT NULL, b tinyint unsigned, c char(5)); insert into t1 values(NULL,100,'mysql'),(10,-1,'mysql ab'),(500,256,'open source'),(20,NULL,'test'); Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 1 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1 Warning 1264 Out of range value adjusted for column 'b' at row 2 Warning 1265 Data truncated for column 'c' at row 2 Warning 1264 Out of range value adjusted for column 'a' at row 3 @@ -99,7 +99,7 @@ Warning 1265 Data truncated for column 'c' at row 2 alter table t1 add d char(2); update t1 set a=NULL where a=10; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 2 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 2 update t1 set c='mysql ab' where c='test'; Warnings: Warning 1265 Data truncated for column 'c' at row 4 @@ -115,7 +115,7 @@ Warnings: Warning 1265 Data truncated for column 'b' at row 1 Warning 1265 Data truncated for column 'b' at row 2 Warning 1265 Data truncated for column 'b' at row 3 -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 4 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 4 Warning 1265 Data truncated for column 'b' at row 4 insert into t2(b) values('mysqlab'); Warnings: -- cgit v1.2.1