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/insert_select.result | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mysql-test/r/insert_select.result') diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result index 49d9c3594db..34e3f0ca2e8 100644 --- a/mysql-test/r/insert_select.result +++ b/mysql-test/r/insert_select.result @@ -606,8 +606,8 @@ NULL 2 100 create table t2(No int not null, Field int not null, Count int not null); insert into t2 Select null, Field, Count From t1 Where Month=20030901 and Type=2; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'No' at row 1 -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'No' at row 2 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'No' at row 1 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'No' at row 2 select * from t2; No Field Count 0 1 100 -- cgit v1.2.1