diff options
author | unknown <evgen@moonbone.local> | 2008-01-11 20:10:54 +0300 |
---|---|---|
committer | unknown <evgen@moonbone.local> | 2008-01-11 20:10:54 +0300 |
commit | 72ebb0aadad120b73be53d727880dd44aa6fe4ad (patch) | |
tree | d210ec8d6329a360c068f6a3af6578b736a2f649 /mysql-test/r/view.result | |
parent | 84762ce2cb01d352858dfff14afa9debffd14d8a (diff) | |
download | mariadb-git-72ebb0aadad120b73be53d727880dd44aa6fe4ad.tar.gz |
Bug#29477: Not all fields of the target table were checked to have a default
value when inserting into a view.
The mysql_prepare_insert function checks all fields of the target table that
directly or indirectly (through a view) are specified in the INSERT
statement to have a default value. This check can be skipped if the INSERT
statement doesn't mention any insert fields. In case of a view this allows
fields that aren't mentioned in the view to bypass the check.
Now fields of the target table are always checked to have a default value
when insert goes into a view.
mysql-test/t/view.test:
Added a test case for the bug#29477: Not all fields of the target table were
checked to have a default value when inserting into a view.
mysql-test/r/view.result:
Added a test case for the bug#29477: Not all fields of the target table were
checked to have a default value when inserting into a view.
sql/sql_insert.cc:
Bug#29477: Not all fields of the target table were checked to have a default
value when inserting into a view.
Now fields of the target table are always checked to have a default value
when insert goes into a view.
Diffstat (limited to 'mysql-test/r/view.result')
-rw-r--r-- | mysql-test/r/view.result | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 0e3d650c571..fb36304e562 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -3602,4 +3602,20 @@ DROP VIEW v1; DROP VIEW v2; DROP VIEW v3; DROP TABLE t1; +# +# Bug#29477: Not all fields of the target table were checked to have +# a default value when inserting into a view. +# +create table t1(f1 int, f2 int not null); +create view v1 as select f1 from t1; +insert into v1 values(1); +Warnings: +Warning 1423 Field of view 'test.v1' underlying table doesn't have a default value +set @old_mode=@@sql_mode; +set @@sql_mode=traditional; +insert into v1 values(1); +ERROR HY000: Field of view 'test.v1' underlying table doesn't have a default value +set @@sql_mode=@old_mode; +drop view v1; +drop table t1; End of 5.0 tests. |