~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to plugin/haildb/tests/r/auto_increment.result

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-06-19 10:46:49 UTC
  • mfrom: (1.1.6)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20120619104649-e2l0ggd4oz3um0f4
Tags: upstream-7.1.36-stable
ImportĀ upstreamĀ versionĀ 7.1.36-stable

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
drop table if exists t1;
2
 
drop table if exists t2;
3
 
SET SQL_WARNINGS=1;
4
 
create TEMPORARY table t1 (a int not null auto_increment,b int, primary key (a)) engine=myisam auto_increment=3;
5
 
insert into t1 values (1,1),(NULL,3),(NULL,4);
6
 
delete from t1 where a=4;
7
 
insert into t1 values (NULL,5),(NULL,6);
8
 
select * from t1;
9
 
a       b
10
 
1       1
11
 
3       3
12
 
5       5
13
 
6       6
14
 
delete from t1 where a=6;
15
 
show table status like "t1";
16
 
Session Schema  Name    Type    Engine  Version Rows    Avg_row_length  Table_size      Auto_increment
17
 
#       test    t1      TEMPORARY       MyISAM  #       #       #       #       #
18
 
replace t1 values (3,1);
19
 
ALTER TABLE t1 add c int;
20
 
replace t1 values (3,3,3);
21
 
insert into t1 values (NULL,7,7);
22
 
update t1 set a=8,b=b+1,c=c+1 where a=7;
23
 
insert into t1 values (NULL,9,9);
24
 
select * from t1;
25
 
a       b       c
26
 
1       1       NULL
27
 
3       3       3
28
 
5       5       NULL
29
 
8       8       8
30
 
9       9       9
31
 
drop table t1;
32
 
create table t1 (
33
 
skey int NOT NULL auto_increment PRIMARY KEY,
34
 
sval char(20)
35
 
);
36
 
insert into t1 values (NULL, "hello");
37
 
insert into t1 values (NULL, "hey");
38
 
select * from t1;
39
 
skey    sval
40
 
1       hello
41
 
2       hey
42
 
select _rowid,t1._rowid,skey,sval from t1;
43
 
_rowid  _rowid  skey    sval
44
 
1       1       1       hello
45
 
2       2       2       hey
46
 
drop table t1;
47
 
create table t1 (a int not null primary key auto_increment);
48
 
insert into t1 values (0);
49
 
update t1 set a=0;
50
 
select * from t1;
51
 
a
52
 
0
53
 
check table t1;
54
 
Table   Op      Msg_type        Msg_text
55
 
test.t1 check   status  OK
56
 
drop table t1;
57
 
create table t1 (a int not null auto_increment primary key);
58
 
insert into t1 values (NULL);
59
 
insert into t1 values (-1);
60
 
select last_insert_id();
61
 
last_insert_id()
62
 
1
63
 
insert into t1 values (NULL);
64
 
select * from t1;
65
 
a
66
 
-1
67
 
1
68
 
2
69
 
drop table t1;
70
 
create temporary table t1 (a int not null auto_increment primary key) /*!40102 engine=MEMORY */;
71
 
insert into t1 values (NULL);
72
 
insert into t1 values (-1);
73
 
select last_insert_id();
74
 
last_insert_id()
75
 
1
76
 
insert into t1 values (NULL);
77
 
select * from t1;
78
 
a
79
 
1
80
 
-1
81
 
2
82
 
drop table t1;
83
 
create table t1 (i int not null auto_increment, key (i));
84
 
insert into t1 set i = 254;
85
 
insert into t1 set i = null;
86
 
select last_insert_id();
87
 
last_insert_id()
88
 
255
89
 
insert into t1 set i = null;
90
 
select last_insert_id();
91
 
last_insert_id()
92
 
256
93
 
drop table t1;
94
 
create table t1 (i int not null auto_increment primary key, b int, unique (b));
95
 
insert into t1 values (NULL, 10);
96
 
select last_insert_id();
97
 
last_insert_id()
98
 
1
99
 
insert into t1 values (NULL, 15);
100
 
select last_insert_id();
101
 
last_insert_id()
102
 
2
103
 
insert into t1 values (NULL, 10);
104
 
Got one of the listed errors
105
 
select last_insert_id();
106
 
last_insert_id()
107
 
2
108
 
drop table t1;
109
 
create table t1(a int auto_increment,b int null,primary key(a));
110
 
insert into t1(a,b)values(NULL,1);
111
 
insert into t1(a,b)values(200,2);
112
 
insert into t1(a,b)values(0,3);
113
 
insert into t1(b)values(4);
114
 
insert into t1(b)values(5);
115
 
insert into t1(b)values(6);
116
 
insert into t1(b)values(7);
117
 
select * from t1 order by b;
118
 
a       b
119
 
1       1
120
 
200     2
121
 
0       3
122
 
201     4
123
 
202     5
124
 
203     6
125
 
204     7
126
 
alter table t1 modify b int;
127
 
show tables;
128
 
Tables_in_test
129
 
t1
130
 
select * from t1 order by b;
131
 
a       b
132
 
1       1
133
 
200     2
134
 
0       3
135
 
201     4
136
 
202     5
137
 
203     6
138
 
204     7
139
 
create table t2 (a int primary key);
140
 
insert t2 values (1),(2);
141
 
alter table t2 drop primary key, add b int auto_increment primary key;
142
 
select * from t2;
143
 
a       b
144
 
1       1
145
 
2       2
146
 
drop table t2;
147
 
delete from t1 where a=0;
148
 
select * from t1;
149
 
a       b
150
 
1       1
151
 
200     2
152
 
201     4
153
 
202     5
154
 
203     6
155
 
204     7
156
 
show create table t1;
157
 
Table   Create Table
158
 
t1      CREATE TABLE `t1` (
159
 
  `a` INT NOT NULL AUTO_INCREMENT,
160
 
  `b` INT DEFAULT NULL,
161
 
  PRIMARY KEY (`a`) USING BTREE
162
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
163
 
update t1 set a=0 where b=5;
164
 
select * from t1 order by b;
165
 
a       b
166
 
1       1
167
 
200     2
168
 
201     4
169
 
0       5
170
 
203     6
171
 
204     7
172
 
delete from t1 where a=0;
173
 
update t1 set a=NULL where b=6;
174
 
ERROR 23000: Column 'a' cannot be null
175
 
update t1 set a=300 where b=7;
176
 
insert into t1(a,b)values(NULL,8);
177
 
insert into t1(a,b)values(400,9);
178
 
insert into t1(a,b)values(0,10);
179
 
insert into t1(b)values(11);
180
 
insert into t1(b)values(12);
181
 
insert into t1(b)values(13);
182
 
insert into t1(b)values(14);
183
 
select * from t1 order by b;
184
 
a       b
185
 
1       1
186
 
200     2
187
 
201     4
188
 
203     6
189
 
300     7
190
 
205     8
191
 
400     9
192
 
0       10
193
 
401     11
194
 
402     12
195
 
403     13
196
 
404     14
197
 
delete from t1 where a=0;
198
 
update t1 set a=0 where b=12;
199
 
select * from t1 order by b;
200
 
a       b
201
 
1       1
202
 
200     2
203
 
201     4
204
 
203     6
205
 
300     7
206
 
205     8
207
 
400     9
208
 
401     11
209
 
0       12
210
 
403     13
211
 
404     14
212
 
delete from t1 where a=0;
213
 
update t1 set a=NULL where b=13;
214
 
ERROR 23000: Column 'a' cannot be null
215
 
update t1 set a=500 where b=14;
216
 
select * from t1 order by b;
217
 
a       b
218
 
1       1
219
 
200     2
220
 
201     4
221
 
203     6
222
 
300     7
223
 
205     8
224
 
400     9
225
 
401     11
226
 
403     13
227
 
500     14
228
 
drop table t1;
229
 
create table t1 (a bigint, b int auto_increment primary key);
230
 
insert into t1 (a) values (1), (2), (3), (NULL), (NULL);
231
 
alter table t1 drop column b, modify a bigint not null auto_increment primary key;
232
 
select * from t1;
233
 
a
234
 
1
235
 
2
236
 
3
237
 
4
238
 
5
239
 
drop table t1;
240
 
create table t1 (a bigint, b int auto_increment primary key);
241
 
insert into t1 (a) values (1), (2), (3), (0), (0);
242
 
alter table t1 drop column b, modify a bigint not null auto_increment primary key;
243
 
Got one of the listed errors
244
 
select * from t1;
245
 
a       b
246
 
1       1
247
 
2       2
248
 
3       3
249
 
0       4
250
 
0       5
251
 
drop table t1;
252
 
create table t1 (a bigint, b int auto_increment primary key);
253
 
insert into t1 (a) values (0), (1), (2), (3);
254
 
alter table t1 drop column b, modify a bigint not null auto_increment primary key;
255
 
select * from t1;
256
 
a
257
 
0
258
 
1
259
 
2
260
 
3
261
 
drop table t1;
262
 
create table t1 (a int auto_increment primary key , b int null);
263
 
insert into t1 values (0,1),(1,2),(2,3);
264
 
select * from t1;
265
 
a       b
266
 
0       1
267
 
1       2
268
 
2       3
269
 
alter table t1 modify b varchar(255);
270
 
insert into t1 values (0,4);
271
 
Got one of the listed errors
272
 
select * from t1;
273
 
a       b
274
 
0       1
275
 
1       2
276
 
2       3
277
 
drop table t1;
278
 
CREATE TABLE t1 ( a INT AUTO_INCREMENT, b VARBINARY(1000), PRIMARY KEY (a,b(10)));
279
 
INSERT INTO t1 (b) VALUES ('aaaa');
280
 
CHECK TABLE t1;
281
 
Table   Op      Msg_type        Msg_text
282
 
test.t1 check   status  OK
283
 
INSERT INTO t1 (b) VALUES ('');
284
 
CHECK TABLE t1;
285
 
Table   Op      Msg_type        Msg_text
286
 
test.t1 check   status  OK
287
 
INSERT INTO t1 (b) VALUES ('bbbb');
288
 
CHECK TABLE t1;
289
 
Table   Op      Msg_type        Msg_text
290
 
test.t1 check   status  OK
291
 
DROP TABLE IF EXISTS t1;
292
 
CREATE TABLE t1 (
293
 
t1_name VARCHAR(255) DEFAULT NULL,
294
 
t1_id INT not null AUTO_INCREMENT,
295
 
KEY (t1_name),
296
 
PRIMARY KEY (t1_id)
297
 
) AUTO_INCREMENT = 1000;
298
 
Warnings:
299
 
Warning 1071    Specified key was too long; max key length is 767 bytes
300
 
INSERT INTO t1 (t1_name) VALUES('MySQL');
301
 
INSERT INTO t1 (t1_name) VALUES('MySQL');
302
 
INSERT INTO t1 (t1_name) VALUES('MySQL');
303
 
SELECT * from t1;
304
 
t1_name t1_id
305
 
MySQL   1000
306
 
MySQL   1001
307
 
MySQL   1002
308
 
SHOW CREATE TABLE `t1`;
309
 
Table   Create Table
310
 
t1      CREATE TABLE `t1` (
311
 
  `t1_name` VARCHAR(255) COLLATE utf8_general_ci DEFAULT NULL,
312
 
  `t1_id` INT NOT NULL AUTO_INCREMENT,
313
 
  PRIMARY KEY (`t1_id`) USING BTREE,
314
 
  KEY `t1_name` (`t1_name`(191)) USING BTREE
315
 
) ENGINE=InnoDB COLLATE = utf8_general_ci AUTO_INCREMENT=1000
316
 
DROP TABLE `t1`;
317
 
create table t1(a int not null auto_increment primary key);
318
 
create table t2(a int not null auto_increment primary key, t1a int);
319
 
insert into t1 values(NULL);
320
 
insert into t2 values (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID());
321
 
insert into t1 values (NULL);
322
 
insert into t2 values (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID()),
323
 
(NULL, LAST_INSERT_ID());
324
 
insert into t1 values (NULL);
325
 
insert into t2 values (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID()),
326
 
(NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID());
327
 
select * from t2;
328
 
a       t1a
329
 
1       1
330
 
2       1
331
 
3       2
332
 
4       2
333
 
5       2
334
 
6       3
335
 
7       3
336
 
8       3
337
 
9       3
338
 
drop table t1, t2;
339
 
End of 4.1 tests
340
 
CREATE TABLE t1 (t1 INT PRIMARY KEY, t2 INT);
341
 
INSERT INTO t1 VALUES(0, 0);
342
 
INSERT INTO t1 VALUES(1, 1);
343
 
ALTER TABLE t1 CHANGE t1 t1 INT auto_increment;
344
 
INSERT INTO t1 VALUES(0,0);
345
 
Got one of the listed errors
346
 
DROP TABLE t1;