summaryrefslogtreecommitdiff
path: root/mysql-test/r/view.result
diff options
context:
space:
mode:
authorunknown <gkodinov@mysql.com>2006-07-04 12:10:12 +0300
committerunknown <gkodinov@mysql.com>2006-07-04 12:10:12 +0300
commite08ff11534c4ca13eea46590841fc38ec72b3462 (patch)
treec001611fa67848fb8274ad02405452540a1b33f7 /mysql-test/r/view.result
parentd0412ab8e01e8410bc6b78bd33cdb844dc580a40 (diff)
downloadmariadb-git-e08ff11534c4ca13eea46590841fc38ec72b3462.tar.gz
Bug #16110: insert permitted into view col w/o default value
When compiling INSERT statements the check whether columns are provided values depends on the flag whether a field is used in that query (Field::query_id). However the check for updatability of VIEW columns (check_view_insertability()) was calling fix_fields() and thus setting the Field::query_id even for the view fields that are not referenced in the current INSERT statement. So the correct check for columns without default values ( check_that_all_fields_are_given_values() ) is assuming that all the VIEW columns were mentioned in the INSERT field list and was issuing no warnings or errors. Fixed check_view_insertability() to turn off the flag whether or not to set Field::query_id (THREAD::set_query_id) before calling fix fields and restore it when it's done. mysql-test/r/view.result: Bug #16110: insert permitted into view col w/o default value * test case mysql-test/t/view.test: Bug #16110: insert permitted into view col w/o default value * test case sql/sql_insert.cc: Bug #16110: insert permitted into view col w/o default value * avoid setting the "field used" flag for fields when checking view columns for updatability. * a missing DBUG_RETURN added.
Diffstat (limited to 'mysql-test/r/view.result')
-rw-r--r--mysql-test/r/view.result16
1 files changed, 15 insertions, 1 deletions
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 5bb407f4256..3cb89a995a1 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -2735,4 +2735,18 @@ m e
4 a
1 b
DROP VIEW v1;
-DROP TABLE IF EXISTS t1,t2;
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a INT NOT NULL, b INT NULL DEFAULT NULL);
+CREATE VIEW v1 AS SELECT a, b FROM t1;
+INSERT INTO v1 (b) VALUES (2);
+Warnings:
+Warning 1423 Field of view 'test.v1' underlying table doesn't have a default value
+SET SQL_MODE = STRICT_ALL_TABLES;
+INSERT INTO v1 (b) VALUES (4);
+ERROR HY000: Field of view 'test.v1' underlying table doesn't have a default value
+SET SQL_MODE = '';
+SELECT * FROM t1;
+a b
+0 2
+DROP VIEW v1;
+DROP TABLE t1;