From: Date: June 7 2006 2:18pm Subject: bk commit into 5.0 tree (evgen:1.2162) BUG#19789 List-Archive: http://lists.mysql.com/commits/7354 X-Bug: 19789 Message-Id: <20060607121802.0182422E0B0@moonbone.moonbone.local> Below is the list of changes that have just been committed into a local 5.0 repository of evgen. When evgen does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.2162 06/06/07 16:17:56 evgen@stripped +3 -0 Fixed bug#19789: REPLACE was allowed for a VIEW with CHECK OPTION enabled. The st_lex::which_check_option_applicable() function controls for which statements WITH CHECK OPTION clause should be taken into account. REPLACE and REPLACE_SELECT wasn't in the list which results in allowing REPLACE to insert wrong rows in a such view. The st_lex::which_check_option_applicable() now includes REPLACE and REPLACE_SELECT in the list of statements for which WITH CHECK OPTION clause is applicable. sql/sql_lex.h 1.217 06/06/07 16:17:16 evgen@stripped +2 -0 Fixed bug#19789: REPLACE was allowed for a VIEW with CHECK OPTION enabled. The st_lex::which_check_option_applicable() now includes REPLACE and REPLACE_SELECT in the list of statements for which WITH CHECK OPTION clause is applicable. mysql-test/r/replace.result 1.10 06/06/07 16:16:55 evgen@stripped +6 -0 Added test case for bug#19789: REPLACE was allowed for a VIEW with CHECK OPTION enabled. mysql-test/t/replace.test 1.13 06/06/07 16:16:29 evgen@stripped +10 -0 Added test case for bug#19789: REPLACE was allowed for a VIEW with CHECK OPTION enabled. # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: evgen # Host: moonbone.local # Root: /work/19789-bug-5.0-opt-mysql --- 1.216/sql/sql_lex.h 2006-05-08 00:25:36 +04:00 +++ 1.217/sql/sql_lex.h 2006-06-07 16:17:16 +04:00 @@ -1000,6 +1000,8 @@ case SQLCOM_UPDATE_MULTI: case SQLCOM_INSERT: case SQLCOM_INSERT_SELECT: + case SQLCOM_REPLACE: + case SQLCOM_REPLACE_SELECT: case SQLCOM_LOAD: return TRUE; default: --- 1.9/mysql-test/r/replace.result 2005-04-05 15:17:39 +04:00 +++ 1.10/mysql-test/r/replace.result 2006-06-07 16:16:55 +04:00 @@ -24,3 +24,9 @@ 63 default_value 127 last drop table t1; +CREATE TABLE t1 (f1 INT); +CREATE VIEW v1 AS SELECT f1 FROM t1 WHERE f1 = 0 WITH CHECK OPTION; +REPLACE INTO v1 (f1) VALUES (1); +ERROR HY000: CHECK OPTION failed 'test.v1' +DROP TABLE t1; +DROP VIEW v1; --- 1.12/mysql-test/t/replace.test 2005-07-28 17:12:35 +04:00 +++ 1.13/mysql-test/t/replace.test 2006-06-07 16:16:29 +04:00 @@ -35,3 +35,13 @@ drop table t1; # End of 4.1 tests + +# +# Bug#19789: REPLACE was allowed for a VIEW with CHECK OPTION enabled. +# +CREATE TABLE t1 (f1 INT); +CREATE VIEW v1 AS SELECT f1 FROM t1 WHERE f1 = 0 WITH CHECK OPTION; +--error 1369 +REPLACE INTO v1 (f1) VALUES (1); +DROP TABLE t1; +DROP VIEW v1;