mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
new lock for multiupdate:
- open and create derived tables - detect which tables should be locked for write - lock and fill derived tables some unitialized variables fixed
This commit is contained in:
@@ -26,7 +26,7 @@ lock table t1 read;
|
||||
update t1,t2 set c=a where b=d;
|
||||
select c from t2;
|
||||
c
|
||||
1
|
||||
2
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
create table t1 (a int);
|
||||
|
||||
@@ -155,7 +155,6 @@ ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
|
||||
UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
|
||||
ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
|
||||
UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;
|
||||
ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
|
||||
unlock tables;
|
||||
LOCK TABLES t1 write, t2 write;
|
||||
UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;
|
||||
@@ -461,6 +460,7 @@ drop table t1, t2, t3;
|
||||
create table t1 (col1 int);
|
||||
create table t2 (col1 int);
|
||||
update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
|
||||
ERROR HY000: You can't specify target table 't1' for update in FROM clause
|
||||
delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1;
|
||||
ERROR HY000: You can't specify target table 't1' for update in FROM clause
|
||||
drop table t1,t2;
|
||||
|
||||
@@ -1339,16 +1339,14 @@ c
|
||||
prepare stmt1 from "update v1,t1 set v1.s1=? where t1.s1=v1.s1";
|
||||
set @arg='d';
|
||||
execute stmt1 using @arg;
|
||||
ERROR HY000: Table 't1' is read only
|
||||
select * from v1;
|
||||
s1
|
||||
c
|
||||
d
|
||||
set @arg='e';
|
||||
execute stmt1 using @arg;
|
||||
ERROR HY000: Table 't1' is read only
|
||||
select * from v1;
|
||||
s1
|
||||
c
|
||||
e
|
||||
deallocate prepare stmt1;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
||||
@@ -159,8 +159,6 @@ LOCK TABLES t1 write, t2 read;
|
||||
DELETE t1.*, t2.* FROM t1,t2 where t1.n=t2.n;
|
||||
--error 1099
|
||||
UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
|
||||
--QQ This should not generate an error
|
||||
--error 1099
|
||||
UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;
|
||||
unlock tables;
|
||||
LOCK TABLES t1 write, t2 write;
|
||||
@@ -428,7 +426,7 @@ drop table t1, t2, t3;
|
||||
#
|
||||
create table t1 (col1 int);
|
||||
create table t2 (col1 int);
|
||||
-- QQ The following should give error 1093
|
||||
-- error 1093
|
||||
update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
|
||||
-- error 1093
|
||||
delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1;
|
||||
|
||||
@@ -1300,13 +1300,9 @@ update v1,t1 set v1.s1='c' where t1.s1=v1.s1;
|
||||
select * from v1;
|
||||
prepare stmt1 from "update v1,t1 set v1.s1=? where t1.s1=v1.s1";
|
||||
set @arg='d';
|
||||
-- QQ This should not generate an error
|
||||
--error 1036
|
||||
execute stmt1 using @arg;
|
||||
select * from v1;
|
||||
set @arg='e';
|
||||
-- QQ This should not generate an error
|
||||
--error 1036
|
||||
execute stmt1 using @arg;
|
||||
select * from v1;
|
||||
deallocate prepare stmt1;
|
||||
|
||||
Reference in New Issue
Block a user