diff options
Diffstat (limited to 'mysql-test/r/view.result')
-rw-r--r-- | mysql-test/r/view.result | 77 |
1 files changed, 75 insertions, 2 deletions
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 18da4882894..232d5472ab9 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -477,8 +477,10 @@ drop view v1; drop table t1; create table t1 (a int); create view v1 as select distinct a from t1 WITH CHECK OPTION; -create view v2 as select distinct a from t1 WITH CASCADED CHECK OPTION; -create view v3 as select distinct a from t1 WITH LOCAL CHECK OPTION; +ERROR HY000: CHECK OPTION on non-updatable view +create view v1 as select a from t1 WITH CHECK OPTION; +create view v2 as select a from t1 WITH CASCADED CHECK OPTION; +create view v3 as select a from t1 WITH LOCAL CHECK OPTION; drop view v3 RESTRICT; drop view v2 CASCADE; drop view v1; @@ -1166,3 +1168,74 @@ Table Create Table v3 CREATE VIEW `test`.`v3` AS select `v1`.`col1` AS `a`,`v2`.`col1` AS `b` from `test`.`v1` join `test`.`v2` where (`v1`.`col1` = `v2`.`col1`) drop view v3, v2, v1; drop table t2, t1; +create table t1 (a int); +create view v1 as select * from t1 where a < 2 with check option; +insert into v1 values(1); +insert into v1 values(3); +ERROR HY000: CHECK OPTION failed +insert ignore into v1 values (2),(3),(0); +Warnings: +Error 1359 CHECK OPTION failed +Error 1359 CHECK OPTION failed +select * from t1; +a +1 +0 +delete from t1; +insert into v1 SELECT 1; +insert into v1 SELECT 3; +ERROR HY000: CHECK OPTION failed +create table t2 (a int); +insert into t2 values (2),(3),(0); +insert ignore into v1 SELECT a from t2; +Warnings: +Error 1359 CHECK OPTION failed +Error 1359 CHECK OPTION failed +select * from t1; +a +1 +0 +update v1 set a=-1 where a=0; +update v1 set a=2 where a=1; +ERROR HY000: CHECK OPTION failed +select * from t1; +a +1 +-1 +update v1 set a=0 where a=0; +insert into t2 values (1); +update v1,t2 set v1.a=v1.a-1 where v1.a=t2.a; +select * from t1; +a +0 +-1 +update v1 set a=a+1; +update ignore v1,t2 set v1.a=v1.a+1 where v1.a=t2.a; +Warnings: +Error 1359 CHECK OPTION failed +select * from t1; +a +1 +1 +drop view v1; +drop table t1, t2; +create table t1 (a int); +create view v1 as select * from t1 where a < 2 with check option; +create view v2 as select * from v1 where a > 0 with local check option; +create view v3 as select * from v1 where a > 0 with cascaded check option; +insert into v2 values (1); +insert into v3 values (1); +insert into v2 values (0); +ERROR HY000: CHECK OPTION failed +insert into v3 values (0); +ERROR HY000: CHECK OPTION failed +insert into v2 values (2); +insert into v3 values (2); +ERROR HY000: CHECK OPTION failed +select * from t1; +a +1 +1 +2 +drop view v3,v2,v1; +drop table t1; |