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 12:44:55-08:00, igor@stripped +3 -0
Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug25931
MERGE: 1.2401.1.1
mysql-test/r/view.result@stripped, 2007-02-07 12:44:53-08:00, igor@stripped +8 -8
Manual merge
MERGE: 1.187.1.1
mysql-test/t/view.test@stripped, 2007-02-07 12:44:53-08:00, igor@stripped +6 -6
Manual merge
MERGE: 1.172.1.1
sql/sql_update.cc@stripped, 2007-02-07 12:34:20-08:00, igor@stripped +0 -0
Auto merged
MERGE: 1.210.1.1
# 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/RESYNC
--- 1.211/sql/sql_update.cc 2007-02-07 12:45:00 -08:00
+++ 1.212/sql/sql_update.cc 2007-02-07 12:45:00 -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 12:45:00 -08:00
+++ 1.189/mysql-test/r/view.result 2007-02-07 12:45:00 -08:00
@@ -834,14 +834,14 @@
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1`
AS select 99999999999999999999999999999999999999999999999999999 AS `col1`
drop view v1;
-create table tü (cü char);
-create view vü as select cü from tü;
-insert into vü values ('ü');
-select * from vü;
-cü
-ü
-drop view vü;
-drop table tü;
+create table tü (cü char);
+create view vü as select cü from tü;
+insert into vü values ('ü');
+select * from vü;
+cü
+ü
+drop view vü;
+drop table tü;
create table t1 (a int, b int);
insert into t1 values (1,2), (1,3), (2,4), (2,5), (3,10);
create view v1(c) as select a+1 from t1 where b >= 4;
@@ -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
@@ -3034,6 +3034,32 @@
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1`
AS select _latin1'The\ZEnd' AS `TheEnd`
DROP VIEW v1;
+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;
CREATE TABLE t1 (mydate DATETIME);
INSERT INTO t1 VALUES
('2007-01-01'), ('2007-01-02'), ('2007-01-30'), ('2007-01-31');
--- 1.173/mysql-test/t/view.test 2007-02-07 12:45:00 -08:00
+++ 1.174/mysql-test/t/view.test 2007-02-07 12:45:00 -08:00
@@ -748,12 +748,12 @@
#
# VIEWs with national characters
#
-create table tü (cü char);
-create view vü as select cü from tü;
-insert into vü values ('ü');
-select * from vü;
-drop view vü;
-drop table tü;
+create table tü (cü char);
+create view vü as select cü from tü;
+insert into vü values ('ü');
+select * from vü;
+drop view vü;
+drop table tü;
#
# problem with used_tables() of outer reference resolved in VIEW
@@ -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;
@@ -2985,6 +2985,28 @@
SHOW CREATE VIEW v1;
DROP VIEW v1;
+
+#
+# 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;
#
# Bug #26124: BETWEEN over a view column of the DATETIME type
| Thread |
|---|
| • bk commit into 5.0 tree (igor:1.2405) | igor | 7 Feb |