diff options
author | unknown <sanja@montyprogram.com> | 2012-02-03 12:24:55 +0200 |
---|---|---|
committer | unknown <sanja@montyprogram.com> | 2012-02-03 12:24:55 +0200 |
commit | 52d4103ccc02c55e05faef188d73d2b07c00084b (patch) | |
tree | 8b74f97e71e64a9cef9d4bdf49ade0396b6b7828 /mysql-test | |
parent | b9616d815d9c318bb2c1028041a210a807d941bc (diff) | |
download | mariadb-git-52d4103ccc02c55e05faef188d73d2b07c00084b.tar.gz |
Fixed DELETE issues of view over view over table.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/view.result | 18 | ||||
-rw-r--r-- | mysql-test/t/view.test | 14 |
2 files changed, 32 insertions, 0 deletions
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 8d1237501f3..0ff06ac09d7 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -3943,12 +3943,20 @@ REPLACE v1 SET a = 10; ERROR HY000: The target table v1 of the INSERT is not insertable-into INSERT into v1 values (20); ERROR HY000: The target table v1 of the INSERT is not insertable-into +DELETE from v1; +ERROR HY000: The target table v1 of the DELETE is not updatable UPDATE v3 SET b= 10; ERROR HY000: The target table v2 of the UPDATE is not updatable REPLACE v3 SET b= 10; ERROR HY000: The target table v3 of the INSERT is not insertable-into INSERT into v3(b) values (20); ERROR HY000: The target table v3 of the INSERT is not insertable-into +DELETE from v3 where b=20; +ERROR HY000: Can not delete from join view 'test.v3' +DELETE from v3 where a=20; +ERROR HY000: Can not delete from join view 'test.v3' +DELETE v1 from v1,t1 where v1.a=t1.a; +ERROR HY000: The target table v1 of the DELETE is not updatable UPDATE v3 SET a = 10; REPLACE v3 SET a = 11; INSERT INTO v3(a) values (20); @@ -3960,6 +3968,16 @@ a 10 11 20 +CREATE OR REPLACE ALGORITHM = MERGE VIEW v2 AS SELECT * FROM t2; +DELETE from v1 where a=11; +DELETE v1 from v1,t1 where v1.a=t1.a; +select * from t1; +a +1 +select * from t2; +a +10 +20 DROP VIEW v1,v2,v3; DROP TABLE t1,t2; # ----------------------------------------------------------------- diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index f691a0c528b..762c3121615 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -3998,11 +3998,19 @@ REPLACE v1 SET a = 10; --error ER_NON_INSERTABLE_TABLE INSERT into v1 values (20); --error ER_NON_UPDATABLE_TABLE +DELETE from v1; +--error ER_NON_UPDATABLE_TABLE UPDATE v3 SET b= 10; --error ER_NON_INSERTABLE_TABLE REPLACE v3 SET b= 10; --error ER_NON_INSERTABLE_TABLE INSERT into v3(b) values (20); +--error ER_VIEW_DELETE_MERGE_VIEW +DELETE from v3 where b=20; +--error ER_VIEW_DELETE_MERGE_VIEW +DELETE from v3 where a=20; +--error ER_NON_UPDATABLE_TABLE +DELETE v1 from v1,t1 where v1.a=t1.a; UPDATE v3 SET a = 10; REPLACE v3 SET a = 11; INSERT INTO v3(a) values (20); @@ -4010,6 +4018,12 @@ INSERT INTO v3(a) values (20); select * from t1; select * from t2; +CREATE OR REPLACE ALGORITHM = MERGE VIEW v2 AS SELECT * FROM t2; +DELETE from v1 where a=11; +DELETE v1 from v1,t1 where v1.a=t1.a; +select * from t1; +select * from t2; + DROP VIEW v1,v2,v3; DROP TABLE t1,t2; |