1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

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

This commit is contained in:
mskold@mysql.com
2004-07-29 14:02:40 +02:00
parent 24f9a2e9bb
commit f05c7ce7c6
2 changed files with 26 additions and 4 deletions

View File

@@ -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;

View File

@@ -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;