Skip to content

Commit

Permalink
addCase (matrixorigin#13451)
Browse files Browse the repository at this point in the history
add bvt test.

Approved by: @heni02
  • Loading branch information
Ariznawlll authored Dec 14, 2023
1 parent 74a8c48 commit cd170fc
Show file tree
Hide file tree
Showing 10 changed files with 179 additions and 2 deletions.
35 changes: 35 additions & 0 deletions test/distributed/cases/ddl/alter_table_AddDrop_column.result
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,15 @@ alter table transaction03 drop column d;
no such table .transaction03
show create table transaction03;
not connect to a database
show create table transaction03;
Table Create Table
transaction03 CREATE TABLE `transaction03` (\n`c` INT NOT NULL,\n`d` INT DEFAULT NULL,\nPRIMARY KEY (`c`)\n)
select * from transaction03;
c d
1 1
2 2
3 1
4 2
drop table transaction03;
drop table if exists transaction05;
create table transaction05(a int not null auto_increment,b varchar(25) not null,c datetime,primary key(a),key bstr (b),key cdate (c) );
Expand Down Expand Up @@ -676,4 +685,30 @@ newrename CREATE TABLE `newrename` (\n`col1` INT DEFAULT NULL\n)
drop table newRename;
drop role role_r1;
drop user role_u1;
drop table if exists table01;
begin;
create table table01(col1 int, col2 char);
insert into table01 values(1,'a');
alter table table01 add column col3 int;
commit;
select * from table01;
col1 col2 col3
1 a null
select col1 from table01;
col1
1
drop table table01;
drop table if exists table02;
begin;
create table table02(col1 int, col2 char);
insert into table02 values(1,'a');
alter table table02 drop column col2;
commit;
select * from table02;
col1
1
select col1 from table02;
col1
1
drop table table02;
drop database test;
22 changes: 22 additions & 0 deletions test/distributed/cases/ddl/alter_table_AddDrop_column.sql
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,8 @@ commit;
alter table transaction03 drop column d;
show create table transaction03;
-- @session}
show create table transaction03;
select * from transaction03;
drop table transaction03;

-- transcation: w-w conflict
Expand Down Expand Up @@ -573,4 +575,24 @@ drop table newRename;
drop role role_r1;
drop user role_u1;

-- begin, alter table add/drop column, commit, then select
drop table if exists table01;
begin;
create table table01(col1 int, col2 char);
insert into table01 values(1,'a');
alter table table01 add column col3 int;
commit;
select * from table01;
select col1 from table01;
drop table table01;

drop table if exists table02;
begin;
create table table02(col1 int, col2 char);
insert into table02 values(1,'a');
alter table table02 drop column col2;
commit;
select * from table02;
select col1 from table02;
drop table table02;
drop database test;
32 changes: 32 additions & 0 deletions test/distributed/cases/ddl/alter_table_add_drop_primary_key.result
Original file line number Diff line number Diff line change
Expand Up @@ -486,3 +486,35 @@ col1 FLOAT(0) NO PRI null
col5 INT(32) YES null
col4 VARCHAR(100) YES null
drop table mix01;
drop table if exists table01;
begin;
create table table01(col1 int, col2 decimal);
insert into table01 values(100,200);
insert into table01 values(200,300);
alter table table01 add constraint primary key (col2);
commit;
select * from table01;
col1 col2
100 200
200 300
select col1 from table01;
col1
100
200
drop table table01;
drop table if exists table01;
begin;
create table table01(col1 int primary key, col2 decimal);
insert into table01 values(100,200);
insert into table01 values(200,300);
alter table table01 drop primary key;
commit;
select * from table01;
col1 col2
100 200
200 300
select col1 from table01;
col1
100
200
drop table table01;
25 changes: 24 additions & 1 deletion test/distributed/cases/ddl/alter_table_add_drop_primary_key.sql
Original file line number Diff line number Diff line change
Expand Up @@ -300,4 +300,27 @@ update mix01 set newnewcol2 = 8290432.324 where newcol3 = 'd';
select * from mix01;
show create table mix01;
show columns from mix01;
drop table mix01;
drop table mix01;

-- begin, alter table add/drop primary key column, commit, then select
drop table if exists table01;
begin;
create table table01(col1 int, col2 decimal);
insert into table01 values(100,200);
insert into table01 values(200,300);
alter table table01 add constraint primary key (col2);
commit;
select * from table01;
select col1 from table01;
drop table table01;

drop table if exists table01;
begin;
create table table01(col1 int primary key, col2 decimal);
insert into table01 values(100,200);
insert into table01 values(200,300);
alter table table01 drop primary key;
commit;
select * from table01;
select col1 from table01;
drop table table01;
13 changes: 13 additions & 0 deletions test/distributed/cases/ddl/alter_table_change_column.result
Original file line number Diff line number Diff line change
Expand Up @@ -2126,4 +2126,17 @@ mix01 col3 DATE YES
mix01 col4 VARCHAR YES
mix01 col5 INT YES
drop table mix01;
drop table if exists table01;
begin;
create table table01(col1 int, col2 decimal);
insert into table01 values(100,200);
alter table table01 change column col1 NewCol1 float;
commit;
select * from table01;
newcol1 col2
100.0 200
select newcol1 from table01;
newcol1
100.0
drop table table01;
drop database db2;
12 changes: 11 additions & 1 deletion test/distributed/cases/ddl/alter_table_change_column.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1150,4 +1150,14 @@ show create table mix01;
select table_name,COLUMN_NAME, data_type,is_nullable from information_schema.columns where table_name like 'mix01' and COLUMN_NAME not like '__mo%';
drop table mix01;

drop database db2;
-- begin, alter table change column, commit, then select
drop table if exists table01;
begin;
create table table01(col1 int, col2 decimal);
insert into table01 values(100,200);
alter table table01 change column col1 NewCol1 float;
commit;
select * from table01;
select newcol1 from table01;
drop table table01;
drop database db2;
13 changes: 13 additions & 0 deletions test/distributed/cases/ddl/alter_table_modify_column.result
Original file line number Diff line number Diff line change
Expand Up @@ -1689,5 +1689,18 @@ mix01 col3 DATE YES
mix01 col4 VARCHAR YES
mix01 col5 INT YES
drop table mix01;
drop table if exists table01;
begin;
create table table01(col1 int, col2 decimal);
insert into table01 values(100,200);
alter table table01 modify column col1 float;
commit;
select * from table01;
col1 col2
100.0 200
select col1 from table01;
col1
100.0
drop table table01;
drop database test;
Can't drop database 'test'; database doesn't exist
10 changes: 10 additions & 0 deletions test/distributed/cases/ddl/alter_table_modify_column.sql
Original file line number Diff line number Diff line change
Expand Up @@ -969,4 +969,14 @@ show create table mix01;
select table_name,COLUMN_NAME, data_type,is_nullable from information_schema.columns where table_name like 'mix01' and COLUMN_NAME not like '__mo%';
drop table mix01;

-- begin, alter table modify column, commit, then select
drop table if exists table01;
begin;
create table table01(col1 int, col2 decimal);
insert into table01 values(100,200);
alter table table01 modify column col1 float;
commit;
select * from table01;
select col1 from table01;
drop table table01;
drop database test;
10 changes: 10 additions & 0 deletions test/distributed/cases/ddl/alter_table_rename_column.result
Original file line number Diff line number Diff line change
Expand Up @@ -527,4 +527,14 @@ col1 col2
2147483647 c
42342 3
drop table prepare01;
drop table if exists table03;
begin;
create table table03(col1 int, col2 char);
alter table table03 rename to NewCol1;
commit;
select * from NewCol1;
col1 col2
select col1 from NewCol1;
col1
drop table NewCol1;
drop database test;
9 changes: 9 additions & 0 deletions test/distributed/cases/ddl/alter_table_rename_column.sql
Original file line number Diff line number Diff line change
Expand Up @@ -325,5 +325,14 @@ insert into prepare01 values (42342, '3');
select * from prepare01;
drop table prepare01;

-- begin, alter table rename, commit, then select
drop table if exists table03;
begin;
create table table03(col1 int, col2 char);
alter table table03 rename to NewCol1;
commit;
select * from NewCol1;
select col1 from NewCol1;
drop table NewCol1;
drop database test;

0 comments on commit cd170fc

Please sign in to comment.