github.com/matrixorigin/matrixone@v1.2.0/test/distributed/cases/optimistic/rollback_stmt3.sql (about)

     1  drop database if exists rollbacktest;
     2  create database rollbacktest;
     3  
     4  set @@autocommit = 0;
     5  
     6  create table t1(a int primary key );
     7  --no error
     8  insert into t1 values(1);
     9  --error. duplicate key
    10  insert into t1 values(1);
    11  --1
    12  select * from t1;
    13  
    14  delete from t1 where a = 1;
    15  --no error
    16  insert into t1 values(1);
    17  --error
    18  insert into t1 values(1);
    19  --1
    20  select * from t1;
    21  
    22  --no error
    23  insert into t1 values(2);
    24  --error
    25  insert into t1 values(2);
    26  
    27  --1
    28  --2
    29  select * from t1;
    30  --no error
    31  insert into t1 values(3);
    32  --no error
    33  delete from t1 where a = 3;
    34  --error. no column b in t1
    35  delete from t1 where b = 3;
    36  --no error
    37  insert into t1 values(3);
    38  --error. duplicate key
    39  update t1 set a = 2;
    40  
    41  commit ;
    42  --1
    43  --2
    44  --3
    45  select * from t1;
    46  
    47  --issue 13678
    48  create table if not exists t2( id int primary key );
    49  insert into t2 values(1);
    50  select * from t2;
    51  
    52  --no error
    53  insert into t2 values(2);
    54  --1
    55  --2
    56  select * from t2;
    57  --error
    58  insert into t2 values(1);
    59  --1
    60  --2
    61  select * from t2;
    62  commit;
    63  --1
    64  --2
    65  select * from t2;
    66  commit;
    67  
    68  
    69  drop table t1;
    70  drop table t2;
    71  drop database if exists rollbacktest;
    72  set @@autocommit = 1;