summaryrefslogtreecommitdiff
path: root/mysql-test/t/view.test
diff options
context:
space:
mode:
authorunknown <gshchepa/uchum@gleb.loc>2007-05-30 12:21:39 +0500
committerunknown <gshchepa/uchum@gleb.loc>2007-05-30 12:21:39 +0500
commit94507ee756a36f98eb67d0ca09e4a1cb429a4a08 (patch)
tree2fd31510209f867f4c9d434c670aa5bcfc89ac64 /mysql-test/t/view.test
parentc57d6f729db784d02a0d0d62f1f9d03ab22fcfda (diff)
downloadmariadb-git-94507ee756a36f98eb67d0ca09e4a1cb429a4a08.tar.gz
Fixed bug #28716.
The result of the CHECK OPTION condition evaluation over an updated record and records of merged tables was arbitrary and dependant on the order of records in the merged tables during the execution of SELECT statement. The CHECK OPTION expression was evaluated over expired record buffers (with arbitrary data in the fields). Rowids of tables used in the CHECK OPTION expression were added to temporary table rows. The multi_update::do_updates() method was modified to restore necessary record buffers before evaluation of the CHECK OPTION condition. sql/sql_class.h: Fixed bug #29716. The multi_update::unupdatable_check_opt_tables variable has been added. sql/sql_update.cc: Fixed bug #29716. Rowids of tables used in the CHECK OPTION expression were added to temporary table rows. The multi_update::do_updates() method was modified to restore necessary record buffers before evaluation of the CHECK OPTION condition. mysql-test/t/view.test: Updated test case for bug #28716. mysql-test/r/view.result: Updated test case for bug #28716.
Diffstat (limited to 'mysql-test/t/view.test')
-rw-r--r--mysql-test/t/view.test16
1 files changed, 16 insertions, 0 deletions
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 3275ba0a687..422c0e4f76b 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -3233,4 +3233,20 @@ CREATE VIEW v1 AS SELECT CAST(1.23456789 AS DECIMAL(8,0)) AS col;
SHOW CREATE VIEW v1;
DROP VIEW v1;
+#
+# Bug #28716: CHECK OPTION expression is evaluated over expired record buffers
+# when VIEW is updated via temporary tables
+#
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (b INT, c INT DEFAULT 0);
+INSERT INTO t1 (a) VALUES (1), (2);
+INSERT INTO t2 (b) VALUES (1), (2);
+CREATE VIEW v1 AS SELECT t2.b,t2.c FROM t1, t2
+ WHERE t1.a=t2.b AND t2.b < 3 WITH CHECK OPTION;
+SELECT * FROM v1;
+UPDATE v1 SET c=1 WHERE b=1;
+SELECT * FROM v1;
+DROP VIEW v1;
+DROP TABLE t1,t2;
+
--echo End of 5.0 tests.