1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-12137 DELETE statement with the same source and target

single-table deletes only
This commit is contained in:
halfspawn
2017-07-07 17:50:09 +02:00
committed by Sergei Golubchik
parent 30fee6150a
commit abf95afa2a
18 changed files with 529 additions and 74 deletions

View File

@ -3743,33 +3743,47 @@ ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 'm1
update m1 set a = ((select max(a) from tmp, v1));
ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 'm1'
delete from m1 where a = (select max(a) from m1);
ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data
insert into t1 (a) values (1);
insert into t2 (a) values (1);
delete from m1 where a = (select max(a) from m2);
ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data
insert into t1 (a) values (1);
insert into t2 (a) values (1);
delete from m1 where a = (select max(a) from t1);
ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data
insert into t1 (a) values (1);
insert into t2 (a) values (1);
delete from m1 where a = (select max(a) from t2);
ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data
insert into t1 (a) values (1);
insert into t2 (a) values (1);
delete from m1 where a = (select max(a) from t3, m1);
ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data
insert into t1 (a) values (1);
insert into t2 (a) values (1);
delete from m1 where a = (select max(a) from t3, m2);
ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data
insert into t1 (a) values (1);
insert into t2 (a) values (1);
delete from m1 where a = (select max(a) from t3, t1);
ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data
insert into t1 (a) values (1);
insert into t2 (a) values (1);
delete from m1 where a = (select max(a) from t3, t2);
ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data
insert into t1 (a) values (1);
insert into t2 (a) values (1);
delete from m1 where a = (select max(a) from tmp, m1);
ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data
insert into t1 (a) values (1);
insert into t2 (a) values (1);
delete from m1 where a = (select max(a) from tmp, m2);
ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data
insert into t1 (a) values (1);
insert into t2 (a) values (1);
delete from m1 where a = (select max(a) from tmp, t1);
ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data
insert into t1 (a) values (1);
insert into t2 (a) values (1);
delete from m1 where a = (select max(a) from tmp, t2);
ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data
insert into t1 (a) values (1);
insert into t2 (a) values (1);
delete from m1 where a = (select max(a) from v1);
ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 'm1'
insert into t1 (a) values (1);
insert into t2 (a) values (1);
delete from m1 where a = (select max(a) from tmp, v1);
ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 'm1'
insert into t1 (a) values (1);
insert into t2 (a) values (1);
drop view v1;
drop temporary table tmp;
drop table t1, t2, t3, m1, m2;