10
create TEMPORARY table t1 (a int not null auto_increment,b int, primary key (a)) engine=myisam auto_increment=3;
10
create table t1 (a int not null auto_increment,b int, primary key (a)) engine=myisam auto_increment=3;
11
11
insert into t1 values (1,1),(NULL,3),(NULL,4);
12
12
delete from t1 where a=4;
13
13
insert into t1 values (NULL,5),(NULL,6);
15
15
delete from t1 where a=6;
16
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
17
show table status like "t1";
16
#show table status like "t1";
18
17
replace t1 values (3,1);
19
18
ALTER TABLE t1 add c int;
20
19
replace t1 values (3,3,3);
38
37
# Test auto_increment on sub key
40
#Drizzle does not support auto_increment on sub key.
41
#create table t1 (a char(10) not null, b int not null auto_increment, primary key(b));
42
#insert into t1 values ("a",1),("b",2),("a",2),("c",1);
43
#insert into t1 values ("a",NULL),("b",NULL),("c",NULL),("e",NULL);
44
#insert into t1 (a) values ("a"),("b"),("c"),("d");
45
#insert into t1 (a) values ('k'),('d');
46
#insert into t1 (a) values ("a");
47
#insert into t1 values ("d",last_insert_id());
51
#create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ordid), index(ord,ordid));
52
#insert into t1 (ordid,ord) values (NULL,'sdj'),(NULL,'sdj');
56
#create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid));
57
#insert into t1 values (NULL,'sdj'),(NULL,'sdj'),(NULL,"abc"),(NULL,'abc'),(NULL,'zzz'),(NULL,'sdj'),(NULL,'abc');
61
#create table t1 (sid char(5), id int(2) NOT NULL auto_increment, key(sid, id));
62
#create table t2 (sid char(20), id int(2));
63
#insert into t2 values ('skr',NULL),('skr',NULL),('test',NULL);
64
#insert into t1 select * from t2;
39
create table t1 (a char(10) not null, b int not null auto_increment, primary key(a,b));
40
insert into t1 values ("a",1),("b",2),("a",2),("c",1);
41
insert into t1 values ("a",NULL),("b",NULL),("c",NULL),("e",NULL);
42
insert into t1 (a) values ("a"),("b"),("c"),("d");
43
insert into t1 (a) values ('k'),('d');
44
insert into t1 (a) values ("a");
45
insert into t1 values ("d",last_insert_id());
49
create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ordid), index(ord,ordid));
50
insert into t1 (ordid,ord) values (NULL,'sdj'),(NULL,'sdj');
54
create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid));
55
insert into t1 values (NULL,'sdj'),(NULL,'sdj'),(NULL,"abc"),(NULL,'abc'),(NULL,'zzz'),(NULL,'sdj'),(NULL,'abc');
59
create table t1 (sid char(5), id int(2) NOT NULL auto_increment, key(sid, id));
60
create table t2 (sid char(20), id int(2));
61
insert into t2 values ('skr',NULL),('skr',NULL),('test',NULL);
62
insert into t1 select * from t2;
69
67
# Test of auto_increment columns when they are set to 0
91
create temporary table t1 (a int not null auto_increment primary key) /*!40102 engine=MEMORY */;
89
create table t1 (a int not null auto_increment primary key) /*!40102 engine=heap */;
92
90
insert into t1 values (NULL);
93
91
insert into t1 values (-1);
94
92
select last_insert_id();
95
93
insert into t1 values (NULL);
97
# last_insert_id() madness
99
create table t1 (i int not null auto_increment primary key);
100
insert into t1 set i = 254;
101
insert into t1 set i = null;
102
select last_insert_id();
103
explain extended select last_insert_id();
105
insert into t1 set i = 254;
106
select last_insert_id();
108
insert into t1 set i = null;
109
select last_insert_id();
99
112
create table t1 (i int not null auto_increment, key (i));
100
113
insert into t1 set i = 254;
282
288
# Test that update changes internal auto-increment value
285
#create table t1 (a int not null auto_increment primary key, val int);
286
#insert into t1 (val) values (1);
287
#update t1 set a=2 where a=1;
288
#insert into t1 (val) values (1);
291
create table t1 (a int not null auto_increment primary key, val int);
292
insert into t1 (val) values (1);
293
update t1 set a=2 where a=1;
294
insert into t1 (val) values (1);
293
299
# Test key duplications with auto-increment in ALTER TABLE
296
#changed syntax of int(11) to int.
297
CREATE TABLE t1 (t1 INT PRIMARY KEY, t2 INT);
302
CREATE TABLE t1 (t1 INT(10) PRIMARY KEY, t2 INT(10));
298
303
INSERT INTO t1 VALUES(0, 0);
299
304
INSERT INTO t1 VALUES(1, 1);
300
ALTER TABLE t1 CHANGE t1 t1 INT auto_increment;
301
305
--error ER_DUP_ENTRY
302
INSERT INTO t1 VALUES(0,0);
306
ALTER TABLE t1 CHANGE t1 t1 INT(10) auto_increment;
305
309
# Test of REPLACE when it does INSERT+DELETE and not UPDATE: