Commit eab01edf authored by unknown's avatar unknown

Added test for fix of bug#3912 Auto increment not correctly initialised when table is altered

parent 785a2eea
...@@ -16,14 +16,31 @@ col3 varchar (20) not null, ...@@ -16,14 +16,31 @@ col3 varchar (20) not null,
col4 varchar(4) not null, col4 varchar(4) not null,
col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null, col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
col6 int not null, to_be_deleted int); col6 int not null, to_be_deleted int);
insert into t1 values (2,4,3,5,"PENDING",1,7); insert into t1 values (2,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (25, 4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7);
select * from t1 order by col1;
col1 col2 col3 col4 col5 col6 to_be_deleted
2 4 3 5 PENDING 1 7
3 4 3 5 PENDING 1 7
25 4 3 5 PENDING 1 7
26 4 3 5 PENDING 1 7
alter table t1 alter table t1
add column col4_5 varchar(20) not null after col4, add column col4_5 varchar(20) not null after col4,
add column col7 varchar(30) not null after col5, add column col7 varchar(30) not null after col5,
add column col8 datetime not null, drop column to_be_deleted, add column col8 datetime not null, drop column to_be_deleted,
change column col2 fourth varchar(30) not null after col3, change column col2 fourth varchar(30) not null after col3,
modify column col6 int not null first; modify column col6 int not null first;
select * from t1; select * from t1 order by col1;
col6 col1 col3 fourth col4 col4_5 col5 col7 col8 col6 col1 col3 fourth col4 col4_5 col5 col7 col8
1 2 3 4 5 PENDING 0000-00-00 00:00:00 1 2 3 4 5 PENDING 0000-00-00 00:00:00
1 3 3 4 5 PENDING 0000-00-00 00:00:00
1 25 3 4 5 PENDING 0000-00-00 00:00:00
1 26 3 4 5 PENDING 0000-00-00 00:00:00
insert into t1 values (2, NULL,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
select * from t1 order by col1;
col6 col1 col3 fourth col4 col4_5 col5 col7 col8
1 2 3 4 5 PENDING 0000-00-00 00:00:00
1 3 3 4 5 PENDING 0000-00-00 00:00:00
1 25 3 4 5 PENDING 0000-00-00 00:00:00
1 26 3 4 5 PENDING 0000-00-00 00:00:00
2 27 4 3 5 99 PENDING EXTRA 2004-01-01 00:00:00
drop table t1; drop table t1;
...@@ -30,12 +30,17 @@ col3 varchar (20) not null, ...@@ -30,12 +30,17 @@ col3 varchar (20) not null,
col4 varchar(4) not null, col4 varchar(4) not null,
col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null, col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
col6 int not null, to_be_deleted int); col6 int not null, to_be_deleted int);
insert into t1 values (2,4,3,5,"PENDING",1,7); insert into t1 values (2,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (25, 4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7);
select * from t1 order by col1;
alter table t1 alter table t1
add column col4_5 varchar(20) not null after col4, add column col4_5 varchar(20) not null after col4,
add column col7 varchar(30) not null after col5, add column col7 varchar(30) not null after col5,
add column col8 datetime not null, drop column to_be_deleted, add column col8 datetime not null, drop column to_be_deleted,
change column col2 fourth varchar(30) not null after col3, change column col2 fourth varchar(30) not null after col3,
modify column col6 int not null first; modify column col6 int not null first;
select * from t1; select * from t1 order by col1;
insert into t1 values (2, NULL,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
select * from t1 order by col1;
drop table t1; drop table t1;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment