|
For multi-table update statements that update views defined using WITH CHECK OPTION clause the clause may be ignored.
The problem can be reproduced with the following test case:
create table t1 (a int) engine=myisam;
|
insert into t1 values (0), (3), (1);
|
create table t2 (a int) engine=myisam;
|
insert into t2 values (1), (0);
|
create view v1 as select * from t1 where a < 2 with check option;
|
update v1,t2 set v1.a=2 where v1.a=t2.a and t2.a=1;
|
select * from t1;
|
drop view v1;
|
drop table t1,t2;
|
We can see that the update statements succeeds and v1 is updated ignoring the condition in WHERE a < 2:
MariaDB [test]> update v1,t2 set v1.a=2 where v1.a=t2.a and t2.a=1;
|
Query OK, 1 row affected (0.001 sec)
|
Rows matched: 1 Changed: 1 Warnings: 0
|
|
MariaDB [test]> select * from t1;
|
+------+
|
| a |
|
+------+
|
| 0 |
|
| 3 |
|
| 2 |
|
+------+
|
3 rows in set (0.001 sec)
|
|