github.com/matrixorigin/matrixone@v1.2.0/test/distributed/cases/optimistic/drop_table_truncate.sql (about) 1 -- Test explicit transactions are nested, Uncommitted content is forced to be submitted 2 drop table if exists t5; 3 start transaction; 4 5 create table t5(a int); 6 insert into t5 values(10),(20),(30); 7 -- execute success 8 drop table t5; 9 10 start transaction; 11 show tables; 12 -- t5 is dropped. error and rollback. 13 insert into t5 values(100),(2000),(3000); 14 15 rollback; 16 set @@autocommit=on; 17 18 --env prepare statement 19 drop table if exists t5; 20 drop table if exists dis_table_02; 21 drop table if exists dis_table_03; 22 23 create table dis_table_02(a int not null auto_increment,b varchar(25) not null,c datetime,primary key(a),key bstr (b),key cdate (c) ); 24 insert into dis_table_02(b,c) values ('aaaa','2020-09-08'); 25 insert into dis_table_02(b,c) values ('aaaa','2020-09-08'); 26 create table dis_table_03(b varchar(25) primary key,c datetime); 27 begin ; 28 insert into dis_table_03 select b,c from dis_table_02; 29 select * from dis_table_03; 30 -- @session:id=1{ 31 use drop_table_truncate; 32 select * from dis_table_03; 33 truncate table dis_table_03; 34 -- @session} 35 insert into dis_table_03 select 'bbb','2012-09-30'; 36 select * from dis_table_03; 37 commit; 38 39 drop table if exists dis_table_02; 40 drop table if exists dis_table_03; 41 42 begin; 43 create table t1(a int); 44 show tables; 45 insert into t1 values (1); 46 drop table t1; 47 show tables; 48 commit; 49 50 create table t1(a int); 51 begin; 52 insert into t1 values (1); 53 select * from t1; 54 -- @session:id=1{ 55 use drop_table_truncate; 56 truncate table t1; 57 select * from t1; 58 -- @session} 59 select * from t1; 60 commit; 61 select * from t1; 62 63 begin; 64 create table t2(a int); 65 show tables; 66 insert into t2 values (1); 67 truncate table t2; 68 insert into t2 values (2); 69 select * from t2; 70 drop table t2; 71 show tables; 72 commit;