diff options
author | unknown <jimw@mysql.com> | 2005-01-13 18:23:34 -0800 |
---|---|---|
committer | unknown <jimw@mysql.com> | 2005-01-13 18:23:34 -0800 |
commit | dcfc9c895a5895f6997b938f24f9240af2d80108 (patch) | |
tree | e4c435a8dda482a7c10a95252cb154e42eaa4a06 /mysql-test/r/strict.result | |
parent | fd7e0d847b6fd2d0f9729b3c6a37f19e62d67128 (diff) | |
download | mariadb-git-dcfc9c895a5895f6997b938f24f9240af2d80108.tar.gz |
In TRADITIONAL mode, don't allow a NOT NULL field with no default be set to
DEFAULT (with no argument) or to the field's type's default by not being
listed in the list of fields being inserted. (Bug #5986)
sql/item.cc:
Add Item_default_value::save_in_field(), with check for setting fields
with no default value set.
sql/item.h:
Implementation of Item_default_value::save_in_field moved to item.cc
sql/sql_insert.cc:
Call check_that_all_fields_are_given_values() if no values were
given and we would be filling row with all default values
mysql-test/t/strict.test:
Add tests for setting fields to DEFAULT in traditional and regular modes
mysql-test/r/strict.result:
Add results
Diffstat (limited to 'mysql-test/r/strict.result')
-rw-r--r-- | mysql-test/r/strict.result | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index fb228d37da3..45f7caa0b11 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -921,3 +921,40 @@ col1 col2 3 99 DROP TABLE t1; +SET @@sql_mode = 'traditional'; +CREATE TABLE t1 (i int not null); +INSERT INTO t1 VALUES (); +ERROR HY000: Field 'i' doesn't have a default value +INSERT INTO t1 VALUES (DEFAULT); +ERROR HY000: Field 'i' doesn't have a default value +INSERT INTO t1 VALUES (DEFAULT(i)); +ERROR HY000: Field 'i' doesn't have a default value +ALTER TABLE t1 ADD j int; +INSERT INTO t1 SET j = 1; +ERROR HY000: Field 'i' doesn't have a default value +INSERT INTO t1 SET j = 1, i = DEFAULT; +ERROR HY000: Field 'i' doesn't have a default value +INSERT INTO t1 SET j = 1, i = DEFAULT(i); +ERROR HY000: Field 'i' doesn't have a default value +INSERT INTO t1 VALUES (DEFAULT,1); +ERROR HY000: Field 'i' doesn't have a default value +DROP TABLE t1; +SET @@sql_mode = ''; +CREATE TABLE t1 (i int not null); +INSERT INTO t1 VALUES (); +INSERT INTO t1 VALUES (DEFAULT); +Warnings: +Warning 1364 Field 'i' doesn't have a default value +INSERT INTO t1 VALUES (DEFAULT(i)); +ERROR HY000: Field 'i' doesn't have a default value +ALTER TABLE t1 ADD j int; +INSERT INTO t1 SET j = 1; +INSERT INTO t1 SET j = 1, i = DEFAULT; +Warnings: +Warning 1364 Field 'i' doesn't have a default value +INSERT INTO t1 SET j = 1, i = DEFAULT(i); +ERROR HY000: Field 'i' doesn't have a default value +INSERT INTO t1 VALUES (DEFAULT,1); +Warnings: +Warning 1364 Field 'i' doesn't have a default value +DROP TABLE t1; |