drop table if exists t1,t2,t3;
drop view if exists v1;
create table t1 (c1 int) engine=maria;
create table t2 (c1 int) engine=maria;
create table t3 (c1 int) engine=maria;
lock tables t1 write, t2 write, t3 write, t1 as t4 read;
alter table t2 add column c2 int;
drop table t1, t2, t3;
create table t1 (a int) engine=maria;
create table t2 (a int) engine=maria;
lock table t1 write, t2 write, t1 as t1_2 write, t2 as t2_2 write;
insert t1 select * from t2;
drop table t2;
"table dropped";
ERROR 42S02: Table 'test.t2' doesn't exist
drop table t1;
create table t1 (a int, b int) engine=maria;
create table t2 (c int, d int) engine=maria;
insert into t1 values(1,1);
insert into t1 values(2,2);
insert into t2 values(1,2);
lock table t1 read;
update t1,t2 set c=a where b=d;
select c from t2;
c
2
unlock tables;
drop table t1;
drop table t2;
create table t1 (a int) engine=maria;
create table t2 (a int) engine=maria;
lock table t1 write, t2 write, t1 as t1_2 write, t2 as t2_2 write;
insert t1 select * from t2;
drop table t2;
ERROR 42S02: Table 'test.t2' doesn't exist
drop table t1;
create table t1 (a int, b int) engine=maria;
insert into t1 values (1, 2), (2, 3), (3, 4);
create table t2 (a int) engine=maria;
insert into t2 values (10), (20), (30);
create view v1 as select a as b, a/10 as a from t2;
lock table t1 write;
alter table t1 add column c int default 100 after a;
update t1, v1 set t1.b=t1.a+t1.b+v1.b where t1.a=v1.a;
unlock tables;
select * from t1;
a	c	b
1	100	13
2	100	25
3	100	37
select * from t2;
a
10
20
30
drop view v1;
drop table t1, t2;
