Below is the list of changes that have just been committed into a local
5.0 repository of igor. When igor 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@stripped, 2007-02-07 14:41:57-08:00, igor@stripped +3 -0
Fixed bug #25931.
View check option clauses were ignored for updates of multi-table
views when the updates could not be performed on fly and the rows
to update had to be put into temporary tables first.
mysql-test/r/view.result@stripped, 2007-02-07 14:41:54-08:00, igor@stripped +27 -1
Added a test case for bug #25931.
mysql-test/t/view.test@stripped, 2007-02-07 14:41:54-08:00, igor@stripped +23 -1
Added a test case for bug #25931.
Adjusted another existed test case to have the correct result.
sql/sql_update.cc@stripped, 2007-02-07 14:41:54-08:00, igor@stripped +9 -0
Fixed bug #25931.
View check option clauses were ignored for updates of multi-table
views when the updates could not be performed on fly and the rows
to update had to be put into temporary tables first.
Added the required check to multi_update::do_updates to fix the problem.
# 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: igor
# Host: olga.mysql.com
# Root: /home/igor/dev-opt/mysql-5.0-opt-bug25931
--- 1.211/sql/sql_update.cc 2007-02-07 14:42:03 -08:00
+++ 1.212/sql/sql_update.cc 2007-02-07 14:42:03 -08:00
@@ -1445,6 +1445,15 @@
if (!can_compare_record || compare_record(table, thd->query_id))
{
+ int error;
+ if ((error= cur_table->view_check_option(thd, ignore)) !=
+ VIEW_CHECK_OK)
+ {
+ if (error == VIEW_CHECK_SKIP)
+ continue;
+ else if (error == VIEW_CHECK_ERROR)
+ goto err;
+ }
if ((local_error=table->file->update_row(table->record[1],
table->record[0])))
{
--- 1.188/mysql-test/r/view.result 2007-02-07 14:42:03 -08:00
+++ 1.189/mysql-test/r/view.result 2007-02-07 14:42:03 -08:00
@@ -2543,7 +2543,7 @@
create view v1 as select ta.f1 as a, tb.f1 as b from t1 ta, t1 tb where ta.f1=tb
.f1 and ta.f2=tb.f2;
insert into t1 values(1,1),(2,2);
-create view v2 as select * from v1 where a > 1 with check option;
+create view v2 as select * from v1 where a > 1 with local check option;
select * from v2;
a b
2 2
@@ -3052,4 +3052,30 @@
2007-01-31 00:00:00
DROP VIEW v1;
DROP TABLE t1;
+CREATE TABLE t1 (a int);
+CREATE TABLE t2 (b int);
+INSERT INTO t1 VALUES (1), (2);
+INSERT INTO t2 VALUES (1), (2);
+CREATE VIEW v1 AS
+SELECT t2.b FROM t1,t2 WHERE t1.a = t2.b WITH CHECK OPTION;
+SELECT * FROM v1;
+b
+1
+2
+UPDATE v1 SET b=3;
+ERROR HY000: CHECK OPTION failed 'test.v1'
+SELECT * FROM v1;
+b
+1
+2
+SELECT * FROM t1;
+a
+1
+2
+SELECT * FROM t2;
+b
+1
+2
+DROP VIEW v1;
+DROP TABLE t1,t2;
End of 5.0 tests.
--- 1.173/mysql-test/t/view.test 2007-02-07 14:42:03 -08:00
+++ 1.174/mysql-test/t/view.test 2007-02-07 14:42:03 -08:00
@@ -2385,7 +2385,7 @@
create view v1 as select ta.f1 as a, tb.f1 as b from t1 ta, t1 tb where ta.f1=tb
.f1 and ta.f2=tb.f2;
insert into t1 values(1,1),(2,2);
-create view v2 as select * from v1 where a > 1 with check option;
+create view v2 as select * from v1 where a > 1 with local check option;
select * from v2;
update v2 set b=3 where a=2;
select * from v2;
@@ -3001,5 +3001,27 @@
DROP VIEW v1;
DROP TABLE t1;
+
+#
+# Bug #25931: update of a multi-table view with check option
+#
+
+CREATE TABLE t1 (a int);
+CREATE TABLE t2 (b int);
+INSERT INTO t1 VALUES (1), (2);
+INSERT INTO t2 VALUES (1), (2);
+
+CREATE VIEW v1 AS
+ SELECT t2.b FROM t1,t2 WHERE t1.a = t2.b WITH CHECK OPTION;
+
+SELECT * FROM v1;
+--error 1369
+UPDATE v1 SET b=3;
+SELECT * FROM v1;
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+DROP VIEW v1;
+DROP TABLE t1,t2;
--echo End of 5.0 tests.
| Thread |
|---|
| • bk commit into 5.0 tree (igor:1.2405) BUG#25931 | igor | 7 Feb |