mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
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.
This commit is contained in:
@ -989,16 +989,16 @@ ERROR 23000: Column 'col2' cannot be null
|
||||
INSERT INTO t1 VALUES (103,'',NULL);
|
||||
ERROR 23000: Column 'col3' cannot be null
|
||||
UPDATE t1 SET col1=NULL WHERE col1 =100;
|
||||
ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'col1' at row 1
|
||||
ERROR 22004: Column was set to data type implicit default; NULL supplied for NOT NULL column 'col1' at row 1
|
||||
UPDATE t1 SET col2 =NULL WHERE col2 ='hello';
|
||||
ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'col2' at row 1
|
||||
ERROR 22004: Column was set to data type implicit default; NULL supplied for NOT NULL column 'col2' at row 1
|
||||
UPDATE t1 SET col2 =NULL where col3 IS NOT NULL;
|
||||
ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'col2' at row 1
|
||||
ERROR 22004: Column was set to data type implicit default; NULL supplied for NOT NULL column 'col2' at row 1
|
||||
INSERT IGNORE INTO t1 values (NULL,NULL,NULL);
|
||||
Warnings:
|
||||
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'col1' at row 1
|
||||
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'col2' at row 1
|
||||
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'col3' at row 1
|
||||
Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'col1' at row 1
|
||||
Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'col2' at row 1
|
||||
Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'col3' at row 1
|
||||
SELECT * FROM t1;
|
||||
col1 col2 col3
|
||||
100 hello 2004-08-20
|
||||
@ -1023,11 +1023,11 @@ ERROR HY000: Field 'col2' doesn't have a default value
|
||||
INSERT INTO t1 (col1) SELECT 1;
|
||||
ERROR HY000: Field 'col2' doesn't have a default value
|
||||
INSERT INTO t1 SELECT 1,NULL;
|
||||
ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'col2' at row 1
|
||||
ERROR 22004: Column was set to data type implicit default; NULL supplied for NOT NULL column 'col2' at row 1
|
||||
INSERT IGNORE INTO t1 values (NULL,NULL);
|
||||
Warnings:
|
||||
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'col1' at row 1
|
||||
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'col2' at row 1
|
||||
Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'col1' at row 1
|
||||
Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'col2' at row 1
|
||||
INSERT IGNORE INTO t1 (col1) values (3);
|
||||
Warnings:
|
||||
Warning 1364 Field 'col2' doesn't have a default value
|
||||
|
Reference in New Issue
Block a user