~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
drop table if exists t1,t2;
2
drop database if exists mysqltest;
3
create table t1 (
4
col1 int not null auto_increment primary key,
5
col2 varchar(30) not null,
6
col3 varchar (20) not null,
7
col4 varchar(4) not null,
8
col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
9
col6 int not null, to_be_deleted int);
10
insert into t1 values (2,4,3,5,"PENDING",1,7);
1976.6.1 by Brian Aker
This is a fix for bug lp:686197
11
SELECT * FROM t1;
12
col1	col2	col3	col4	col5	col6	to_be_deleted
13
2	4	3	5	PENDING	1	7
1 by brian
clean slate
14
alter table t1
15
add column col4_5 varchar(20) not null after col4,
16
add column col7 varchar(30) not null after col5,
1606 by Brian Aker
datetime was still allowing an alter table with an invalid date.
17
add column col8 datetime not null default '1000-01-01 00:00:00', drop column to_be_deleted,
1 by brian
clean slate
18
change column col2 fourth varchar(30) not null after col3,
19
modify column col6 int not null first;
1976.6.1 by Brian Aker
This is a fix for bug lp:686197
20
ERROR HY000: Either a DEFAULt value or NULL NULL description is required for a new column if table is not empty
21
alter table t1
22
add column col4_5 varchar(20) DEFAULT "added" not null after col4,
23
add column col7 varchar(30) DEFAULT "added" not null after col5,
24
add column col8 datetime not null default '1000-01-01 00:00:00',
25
drop column to_be_deleted,
26
change column col2 fourth varchar(30) not null after col3,
27
modify column col6 int not null first;
1 by brian
clean slate
28
select * from t1;
29
col6	col1	col3	fourth	col4	col4_5	col5	col7	col8
1976.6.1 by Brian Aker
This is a fix for bug lp:686197
30
1	2	3	4	5	added	PENDING	added	1000-01-01 00:00:00
1 by brian
clean slate
31
drop table t1;
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
32
create table t1 (bandID INT NOT NULL PRIMARY KEY, payoutID int NOT NULL);
1 by brian
clean slate
33
insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,12),(8,12);
201 by Brian Aker
Convert default engine to Innodb
34
alter table t1 add column new_col int;
1 by brian
clean slate
35
select * from t1;
36
bandID	payoutID	new_col
37
1	6	NULL
38
2	6	NULL
201 by Brian Aker
Convert default engine to Innodb
39
3	4	NULL
1 by brian
clean slate
40
4	9	NULL
41
5	10	NULL
201 by Brian Aker
Convert default engine to Innodb
42
6	1	NULL
1 by brian
clean slate
43
7	12	NULL
44
8	12	NULL
201 by Brian Aker
Convert default engine to Innodb
45
alter table t1;
1 by brian
clean slate
46
select * from t1;
47
bandID	payoutID	new_col
48
1	6	NULL
49
2	6	NULL
50
3	4	NULL
51
4	9	NULL
52
5	10	NULL
53
6	1	NULL
54
7	12	NULL
55
8	12	NULL
56
drop table t1;
57
CREATE TABLE t1 (
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
58
GROUP_ID int DEFAULT '0' NOT NULL,
59
LANG_ID int DEFAULT '0' NOT NULL,
1 by brian
clean slate
60
NAME varchar(80) DEFAULT '' NOT NULL,
61
PRIMARY KEY (GROUP_ID,LANG_ID),
62
KEY NAME (NAME));
63
ALTER TABLE t1 CHANGE NAME NAME CHAR(80) not null;
1273.13.37 by Brian Aker
Remove "full" syntax.
64
show COLUMNS FROM t1;
1309.2.4 by Brian Aker
New version of show columns code.
65
Field	Type	Null	Default	Default_is_NULL	On_Update
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
66
GROUP_ID	INTEGER	NO	0	NO	
67
LANG_ID	INTEGER	NO	0	NO	
68
NAME	VARCHAR	NO		NO	
1 by brian
clean slate
69
DROP TABLE t1;
70
create table t1 (n int);
71
insert into t1 values(9),(3),(12),(10);
72
alter table t1 order by n;
73
select * from t1;
74
n
75
3
76
9
77
10
78
12
79
drop table t1;
1063.9.3 by Brian Aker
Partial fix for tests for tmp
80
CREATE TEMPORARY TABLE t1 (
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
81
id int NOT NULL default '0',
82
category_id int NOT NULL default '0',
83
type_id int NOT NULL default '0',
1 by brian
clean slate
84
body text NOT NULL,
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
85
user_id int NOT NULL default '0',
1 by brian
clean slate
86
status enum('new','old') NOT NULL default 'new',
87
PRIMARY KEY (id)
88
) ENGINE=MyISAM;
89
ALTER TABLE t1 ORDER BY t1.id, t1.status, t1.type_id, t1.user_id, t1.body;
90
DROP TABLE t1;
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
91
create table t1 (i int not null auto_increment primary key);
1 by brian
clean slate
92
insert into t1 values (null),(null),(null),(null);
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
93
alter table t1 drop i,add i int not null auto_increment, drop primary key, add primary key (i);
1 by brian
clean slate
94
select * from t1;
95
i
96
1
97
2
98
3
99
4
100
drop table t1;
101
create table t1 (name char(15));
102
insert into t1 (name) values ("current");
103
create database mysqltest;
104
create table mysqltest.t1 (name char(15));
105
insert into mysqltest.t1 (name) values ("mysqltest");
106
select * from t1;
107
name
108
current
109
select * from mysqltest.t1;
110
name
111
mysqltest
112
alter table t1 rename mysqltest.t1;
1395.1.2 by Brian Aker
More logic pulling from ALTER TABLE
113
ERROR 42S01: Table 'mysqltest.t1' already exists
1 by brian
clean slate
114
select * from t1;
115
name
116
current
117
select * from mysqltest.t1;
118
name
119
mysqltest
120
drop table t1;
121
drop database mysqltest;
122
create table t1 (n1 int not null, n2 int, n3 int, n4 float,
123
unique(n1),
124
key (n1, n2, n3, n4),
125
key (n2, n3, n4, n1),
126
key (n3, n4, n1, n2),
127
key (n4, n1, n2, n3) );
201 by Brian Aker
Convert default engine to Innodb
128
alter table t1;
1 by brian
clean slate
129
show keys from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
130
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
131
t1	YES	n1	1	n1
132
t1	NO	n1_2	1	n1
133
t1	NO	n1_2	2	n2
134
t1	NO	n1_2	3	n3
135
t1	NO	n1_2	4	n4
136
t1	NO	n2	1	n2
137
t1	NO	n2	2	n3
138
t1	NO	n2	3	n4
139
t1	NO	n2	4	n1
140
t1	NO	n3	1	n3
141
t1	NO	n3	2	n4
142
t1	NO	n3	3	n1
143
t1	NO	n3	4	n2
144
t1	NO	n4	1	n4
145
t1	NO	n4	2	n1
146
t1	NO	n4	3	n2
147
t1	NO	n4	4	n3
206.1.1 by Stewart Smith
cut 'make test' time in half.
148
set autocommit=0;
149
begin;
1 by brian
clean slate
150
insert into t1 values(10,RAND()*1000,RAND()*1000,RAND());
151
insert into t1 values(9,RAND()*1000,RAND()*1000,RAND());
152
insert into t1 values(8,RAND()*1000,RAND()*1000,RAND());
153
insert into t1 values(7,RAND()*1000,RAND()*1000,RAND());
154
insert into t1 values(6,RAND()*1000,RAND()*1000,RAND());
155
insert into t1 values(5,RAND()*1000,RAND()*1000,RAND());
156
insert into t1 values(4,RAND()*1000,RAND()*1000,RAND());
157
insert into t1 values(3,RAND()*1000,RAND()*1000,RAND());
158
insert into t1 values(2,RAND()*1000,RAND()*1000,RAND());
159
insert into t1 values(1,RAND()*1000,RAND()*1000,RAND());
206.1.1 by Stewart Smith
cut 'make test' time in half.
160
commit;
161
set autocommit=1;
1 by brian
clean slate
162
alter table t1 enable keys;
201 by Brian Aker
Convert default engine to Innodb
163
Warnings:
164
Note	1031	Table storage engine for 't1' doesn't have this option
1 by brian
clean slate
165
show keys from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
166
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
167
t1	YES	n1	1	n1
168
t1	NO	n1_2	1	n1
169
t1	NO	n1_2	2	n2
170
t1	NO	n1_2	3	n3
171
t1	NO	n1_2	4	n4
172
t1	NO	n2	1	n2
173
t1	NO	n2	2	n3
174
t1	NO	n2	3	n4
175
t1	NO	n2	4	n1
176
t1	NO	n3	1	n3
177
t1	NO	n3	2	n4
178
t1	NO	n3	3	n1
179
t1	NO	n3	4	n2
180
t1	NO	n4	1	n4
181
t1	NO	n4	2	n1
182
t1	NO	n4	3	n2
183
t1	NO	n4	4	n3
1 by brian
clean slate
184
drop table t1;
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
185
create table t1 (i int not null auto_increment primary key);
1 by brian
clean slate
186
alter table t1 rename t2;
187
alter table t2 rename t1, add c char(10) comment "no comment";
188
show columns from t1;
1309.2.4 by Brian Aker
New version of show columns code.
189
Field	Type	Null	Default	Default_is_NULL	On_Update
1638.10.114 by Stewart Smith
when creating a CreateField from a Field, a auto_incremen column should not have a default value of 0 as that's not magic.
190
i	INTEGER	NO		NO	
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
191
c	VARCHAR	YES		YES	
1 by brian
clean slate
192
drop table t1;
193
create table t1 (a int, b int);
206.1.1 by Stewart Smith
cut 'make test' time in half.
194
set autocommit=0;
195
begin;
1 by brian
clean slate
196
insert into t1 values(1,100), (2,100), (3, 100);
197
insert into t1 values(1,99), (2,99), (3, 99);
198
insert into t1 values(1,98), (2,98), (3, 98);
199
insert into t1 values(1,97), (2,97), (3, 97);
200
insert into t1 values(1,96), (2,96), (3, 96);
201
insert into t1 values(1,95), (2,95), (3, 95);
202
insert into t1 values(1,94), (2,94), (3, 94);
203
insert into t1 values(1,93), (2,93), (3, 93);
204
insert into t1 values(1,92), (2,92), (3, 92);
205
insert into t1 values(1,91), (2,91), (3, 91);
206
insert into t1 values(1,90), (2,90), (3, 90);
207
insert into t1 values(1,89), (2,89), (3, 89);
208
insert into t1 values(1,88), (2,88), (3, 88);
209
insert into t1 values(1,87), (2,87), (3, 87);
210
insert into t1 values(1,86), (2,86), (3, 86);
211
insert into t1 values(1,85), (2,85), (3, 85);
212
insert into t1 values(1,84), (2,84), (3, 84);
213
insert into t1 values(1,83), (2,83), (3, 83);
214
insert into t1 values(1,82), (2,82), (3, 82);
215
insert into t1 values(1,81), (2,81), (3, 81);
216
insert into t1 values(1,80), (2,80), (3, 80);
217
insert into t1 values(1,79), (2,79), (3, 79);
218
insert into t1 values(1,78), (2,78), (3, 78);
219
insert into t1 values(1,77), (2,77), (3, 77);
220
insert into t1 values(1,76), (2,76), (3, 76);
221
insert into t1 values(1,75), (2,75), (3, 75);
222
insert into t1 values(1,74), (2,74), (3, 74);
223
insert into t1 values(1,73), (2,73), (3, 73);
224
insert into t1 values(1,72), (2,72), (3, 72);
225
insert into t1 values(1,71), (2,71), (3, 71);
226
insert into t1 values(1,70), (2,70), (3, 70);
227
insert into t1 values(1,69), (2,69), (3, 69);
228
insert into t1 values(1,68), (2,68), (3, 68);
229
insert into t1 values(1,67), (2,67), (3, 67);
230
insert into t1 values(1,66), (2,66), (3, 66);
231
insert into t1 values(1,65), (2,65), (3, 65);
232
insert into t1 values(1,64), (2,64), (3, 64);
233
insert into t1 values(1,63), (2,63), (3, 63);
234
insert into t1 values(1,62), (2,62), (3, 62);
235
insert into t1 values(1,61), (2,61), (3, 61);
236
insert into t1 values(1,60), (2,60), (3, 60);
237
insert into t1 values(1,59), (2,59), (3, 59);
238
insert into t1 values(1,58), (2,58), (3, 58);
239
insert into t1 values(1,57), (2,57), (3, 57);
240
insert into t1 values(1,56), (2,56), (3, 56);
241
insert into t1 values(1,55), (2,55), (3, 55);
242
insert into t1 values(1,54), (2,54), (3, 54);
243
insert into t1 values(1,53), (2,53), (3, 53);
244
insert into t1 values(1,52), (2,52), (3, 52);
245
insert into t1 values(1,51), (2,51), (3, 51);
246
insert into t1 values(1,50), (2,50), (3, 50);
247
insert into t1 values(1,49), (2,49), (3, 49);
248
insert into t1 values(1,48), (2,48), (3, 48);
249
insert into t1 values(1,47), (2,47), (3, 47);
250
insert into t1 values(1,46), (2,46), (3, 46);
251
insert into t1 values(1,45), (2,45), (3, 45);
252
insert into t1 values(1,44), (2,44), (3, 44);
253
insert into t1 values(1,43), (2,43), (3, 43);
254
insert into t1 values(1,42), (2,42), (3, 42);
255
insert into t1 values(1,41), (2,41), (3, 41);
256
insert into t1 values(1,40), (2,40), (3, 40);
257
insert into t1 values(1,39), (2,39), (3, 39);
258
insert into t1 values(1,38), (2,38), (3, 38);
259
insert into t1 values(1,37), (2,37), (3, 37);
260
insert into t1 values(1,36), (2,36), (3, 36);
261
insert into t1 values(1,35), (2,35), (3, 35);
262
insert into t1 values(1,34), (2,34), (3, 34);
263
insert into t1 values(1,33), (2,33), (3, 33);
264
insert into t1 values(1,32), (2,32), (3, 32);
265
insert into t1 values(1,31), (2,31), (3, 31);
266
insert into t1 values(1,30), (2,30), (3, 30);
267
insert into t1 values(1,29), (2,29), (3, 29);
268
insert into t1 values(1,28), (2,28), (3, 28);
269
insert into t1 values(1,27), (2,27), (3, 27);
270
insert into t1 values(1,26), (2,26), (3, 26);
271
insert into t1 values(1,25), (2,25), (3, 25);
272
insert into t1 values(1,24), (2,24), (3, 24);
273
insert into t1 values(1,23), (2,23), (3, 23);
274
insert into t1 values(1,22), (2,22), (3, 22);
275
insert into t1 values(1,21), (2,21), (3, 21);
276
insert into t1 values(1,20), (2,20), (3, 20);
277
insert into t1 values(1,19), (2,19), (3, 19);
278
insert into t1 values(1,18), (2,18), (3, 18);
279
insert into t1 values(1,17), (2,17), (3, 17);
280
insert into t1 values(1,16), (2,16), (3, 16);
281
insert into t1 values(1,15), (2,15), (3, 15);
282
insert into t1 values(1,14), (2,14), (3, 14);
283
insert into t1 values(1,13), (2,13), (3, 13);
284
insert into t1 values(1,12), (2,12), (3, 12);
285
insert into t1 values(1,11), (2,11), (3, 11);
286
insert into t1 values(1,10), (2,10), (3, 10);
287
insert into t1 values(1,9), (2,9), (3, 9);
288
insert into t1 values(1,8), (2,8), (3, 8);
289
insert into t1 values(1,7), (2,7), (3, 7);
290
insert into t1 values(1,6), (2,6), (3, 6);
291
insert into t1 values(1,5), (2,5), (3, 5);
292
insert into t1 values(1,4), (2,4), (3, 4);
293
insert into t1 values(1,3), (2,3), (3, 3);
294
insert into t1 values(1,2), (2,2), (3, 2);
295
insert into t1 values(1,1), (2,1), (3, 1);
206.1.1 by Stewart Smith
cut 'make test' time in half.
296
commit;
297
set autocommit=1;
1 by brian
clean slate
298
alter table t1 add unique (a,b), add key (b);
299
show keys from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
300
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
301
t1	YES	a	1	a
302
t1	YES	a	2	b
303
t1	NO	b	1	b
1 by brian
clean slate
304
analyze table t1;
305
Table	Op	Msg_type	Msg_text
306
test.t1	analyze	status	OK
307
show keys from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
308
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
309
t1	YES	a	1	a
310
t1	YES	a	2	b
311
t1	NO	b	1	b
1 by brian
clean slate
312
drop table t1;
1063.9.3 by Brian Aker
Partial fix for tests for tmp
313
CREATE TEMPORARY TABLE t1 (
1217 by Brian Aker
Removed bits of charset support from the parser.
314
Host varchar(16) NOT NULL default '',
315
User varchar(16) NOT NULL default '',
1 by brian
clean slate
316
PRIMARY KEY  (Host,User),
317
KEY  (Host)
318
) ENGINE=MyISAM;
319
ALTER TABLE t1 DISABLE KEYS;
320
INSERT INTO t1 VALUES ('localhost','root'),('localhost','');
321
ALTER TABLE t1 ENABLE KEYS;
322
CHECK TABLES t1;
323
Table	Op	Msg_type	Msg_text
324
test.t1	check	status	OK
325
ALTER TABLE t1 RENAME t2;
326
select * from t2;
327
Host	User
328
localhost	
329
localhost	root
330
DROP TABLE t2;
331
create table t1 (a int);
332
alter table t1 rename to ``;
333
ERROR 42000: Incorrect table name ''
334
rename table t1 to ``;
335
ERROR 42000: Incorrect table name ''
336
drop table t1;
337
drop table if exists t1;
338
Warnings:
339
Note	1051	Unknown table 't1'
1063.9.3 by Brian Aker
Partial fix for tests for tmp
340
create TEMPORARY table t1 ( a varchar(10) not null primary key ) engine=myisam;
1 by brian
clean slate
341
flush tables;
342
alter table t1 modify a varchar(10);
343
flush tables;
344
alter table t1 modify a varchar(10) not null;
345
drop table if exists t1;
1063.9.3 by Brian Aker
Partial fix for tests for tmp
346
create TEMPORARY table t1 (a int, b int, c int, d int, e int, f int, g int, h int,i int, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM;
896.3.6 by Stewart Smith
Read Fields out of proto instead of FRM.
347
insert into t1 (a,b,c,d,e,f,g,h,i) values(1,1,1,1,1,1,1,1,1);
1 by brian
clean slate
348
show table status like 't1';
1320.1.18 by Brian Aker
Overhaul of SHOW TABLE STATUS.
349
Session	Schema	Name	Type	Engine	Version	Rows	Avg_row_length	Table_size	Auto_increment
350
#	test	t1	TEMPORARY	MyISAM	#	#	#	#	#
1 by brian
clean slate
351
alter table t1 modify a int;
352
show table status like 't1';
1320.1.18 by Brian Aker
Overhaul of SHOW TABLE STATUS.
353
Session	Schema	Name	Type	Engine	Version	Rows	Avg_row_length	Table_size	Auto_increment
354
#	test	t1	TEMPORARY	MyISAM	#	#	#	#	#
1 by brian
clean slate
355
drop table t1;
1063.9.3 by Brian Aker
Partial fix for tests for tmp
356
create TEMPORARY table t1 (a int not null default 0, b int not null default 0, c int not null default 0, d int not null default 0, e int not null default 0, f int not null default 0, g int not null default 0, h int not null default 0,i int not null default 0, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM;
1 by brian
clean slate
357
insert into t1 (a) values(1);
358
show table status like 't1';
1320.1.18 by Brian Aker
Overhaul of SHOW TABLE STATUS.
359
Session	Schema	Name	Type	Engine	Version	Rows	Avg_row_length	Table_size	Auto_increment
360
#	test	t1	TEMPORARY	MyISAM	#	#	#	#	#
1 by brian
clean slate
361
drop table t1;
362
CREATE TABLE t1 (a int PRIMARY KEY, b INT UNIQUE);
363
ALTER TABLE t1 DROP PRIMARY KEY;
364
SHOW CREATE TABLE t1;
365
Table	Create Table
352.2.1 by Harrison Fisk
Fix for bugs 259843 and 256482
366
t1	CREATE TABLE `t1` (
1743.5.2 by LinuxJedi
Alter many test cases for the new SHOW CREATE TABLE output
367
  `a` INT NOT NULL,
368
  `b` INT DEFAULT NULL,
2363.1.5 by Brian Aker
This patch fixes 798940, we will also just now add the type of index to our create statements.
369
  UNIQUE KEY `b` (`b`) USING BTREE
1638.10.54 by Stewart Smith
alter_table.result: COLLATE and ENGINE in same line for SHOW CREATE TABLE
370
) ENGINE=DEFAULT COLLATE = utf8_general_ci
1 by brian
clean slate
371
ALTER TABLE t1 DROP PRIMARY KEY;
372
ERROR 42000: Can't DROP 'PRIMARY'; check that column/key exists
373
DROP TABLE t1;
374
create table t1 (a int, b int, key(a));
375
insert into t1 values (1,1), (2,2);
376
alter table t1 drop key no_such_key;
377
ERROR 42000: Can't DROP 'no_such_key'; check that column/key exists
378
alter table t1 drop key a;
379
drop table t1;
1063.9.3 by Brian Aker
Partial fix for tests for tmp
380
CREATE TEMPORARY TABLE T12207(a int) ENGINE=MYISAM;
1 by brian
clean slate
381
ALTER TABLE T12207 DISCARD TABLESPACE;
382
ERROR HY000: Table storage engine for 'T12207' doesn't have this option
383
DROP TABLE T12207;
384
create table t1 ( a timestamp );
385
alter table t1 add unique ( a(1) );
386
ERROR HY000: Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys
387
drop table t1;
388
drop table if exists t1;
389
create table t1 (a int, key(a));
390
show indexes from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
391
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
392
t1	NO	a	1	a
1 by brian
clean slate
393
"this used not to disable the index"
201 by Brian Aker
Convert default engine to Innodb
394
alter table t1 modify a int;
395
show indexes from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
396
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
397
t1	NO	a	1	a
201 by Brian Aker
Convert default engine to Innodb
398
alter table t1 enable keys;
399
Warnings:
400
Note	1031	Table storage engine for 't1' doesn't have this option
401
show indexes from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
402
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
403
t1	NO	a	1	a
201 by Brian Aker
Convert default engine to Innodb
404
alter table t1 modify a bigint;
405
show indexes from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
406
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
407
t1	NO	a	1	a
201 by Brian Aker
Convert default engine to Innodb
408
alter table t1 enable keys;
409
Warnings:
410
Note	1031	Table storage engine for 't1' doesn't have this option
411
show indexes from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
412
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
413
t1	NO	a	1	a
201 by Brian Aker
Convert default engine to Innodb
414
alter table t1 add b char(10);
415
show indexes from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
416
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
417
t1	NO	a	1	a
201 by Brian Aker
Convert default engine to Innodb
418
alter table t1 add c decimal(10,2);
419
show indexes from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
420
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
421
t1	NO	a	1	a
1 by brian
clean slate
422
"this however did"
201 by Brian Aker
Convert default engine to Innodb
423
alter table t1;
1 by brian
clean slate
424
show indexes from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
425
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
426
t1	NO	a	1	a
1 by brian
clean slate
427
desc t1;
1309.4.3 by Brian Aker
Refactor DESC to use new table.
428
Field	Type	Null	Default	Default_is_NULL	On_Update
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
429
a	BIGINT	YES		YES	
430
b	VARCHAR	YES		YES	
431
c	DECIMAL	YES		YES	
1 by brian
clean slate
432
alter table t1 add d decimal(15,5);
433
"The key should still be disabled"
434
show indexes from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
435
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
436
t1	NO	a	1	a
1 by brian
clean slate
437
drop table t1;
438
"Now will test with one unique index"
439
create table t1(a int, b char(10), unique(a));
440
show indexes from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
441
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
442
t1	YES	a	1	a
201 by Brian Aker
Convert default engine to Innodb
443
alter table t1;
1 by brian
clean slate
444
show indexes from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
445
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
446
t1	YES	a	1	a
1 by brian
clean slate
447
alter table t1 enable keys;
201 by Brian Aker
Convert default engine to Innodb
448
Warnings:
449
Note	1031	Table storage engine for 't1' doesn't have this option
1 by brian
clean slate
450
"If no copy on noop change, this won't touch the data file"
451
"Unique index, no change"
201 by Brian Aker
Convert default engine to Innodb
452
alter table t1 modify a int;
1 by brian
clean slate
453
show indexes from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
454
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
455
t1	YES	a	1	a
1 by brian
clean slate
456
"Change the type implying data copy"
457
"Unique index, no change"
201 by Brian Aker
Convert default engine to Innodb
458
alter table t1 modify a bigint;
459
show indexes from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
460
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
461
t1	YES	a	1	a
201 by Brian Aker
Convert default engine to Innodb
462
alter table t1 modify a bigint;
463
show indexes from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
464
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
465
t1	YES	a	1	a
1 by brian
clean slate
466
alter table t1 modify a int;
467
show indexes from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
468
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
469
t1	YES	a	1	a
1 by brian
clean slate
470
drop table t1;
471
"Now will test with one unique and one non-unique index"
472
create table t1(a int, b char(10), unique(a), key(b));
473
show indexes from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
474
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
475
t1	YES	a	1	a
476
t1	NO	b	1	b
201 by Brian Aker
Convert default engine to Innodb
477
alter table t1;
1 by brian
clean slate
478
show indexes from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
479
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
480
t1	YES	a	1	a
481
t1	NO	b	1	b
1 by brian
clean slate
482
alter table t1 enable keys;
201 by Brian Aker
Convert default engine to Innodb
483
Warnings:
484
Note	1031	Table storage engine for 't1' doesn't have this option
1 by brian
clean slate
485
"If no copy on noop change, this won't touch the data file"
486
"The non-unique index will be disabled"
201 by Brian Aker
Convert default engine to Innodb
487
alter table t1 modify a int;
1 by brian
clean slate
488
show indexes from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
489
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
490
t1	YES	a	1	a
491
t1	NO	b	1	b
1 by brian
clean slate
492
alter table t1 enable keys;
201 by Brian Aker
Convert default engine to Innodb
493
Warnings:
494
Note	1031	Table storage engine for 't1' doesn't have this option
1 by brian
clean slate
495
show indexes from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
496
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
497
t1	YES	a	1	a
498
t1	NO	b	1	b
1 by brian
clean slate
499
"Change the type implying data copy"
500
"The non-unique index will be disabled"
201 by Brian Aker
Convert default engine to Innodb
501
alter table t1 modify a bigint;
1 by brian
clean slate
502
show indexes from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
503
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
504
t1	YES	a	1	a
505
t1	NO	b	1	b
1 by brian
clean slate
506
"Change again the type, but leave the indexes as_is"
507
alter table t1 modify a int;
508
show indexes from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
509
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
510
t1	YES	a	1	a
511
t1	NO	b	1	b
1 by brian
clean slate
512
"Try the same. When data is no copied on similar tables, this is noop"
513
alter table t1 modify a int;
514
show indexes from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
515
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
516
t1	YES	a	1	a
517
t1	NO	b	1	b
1 by brian
clean slate
518
drop table t1;
519
create database mysqltest;
520
create table t1 (c1 int);
521
alter table t1 rename mysqltest.t1;
522
drop table t1;
523
ERROR 42S02: Unknown table 't1'
524
alter table mysqltest.t1 rename t1;
525
drop table t1;
526
create table t1 (c1 int);
527
use mysqltest;
528
drop database mysqltest;
529
alter table test.t1 rename t1;
1843.7.6 by Brian Aker
This cleans up error messages to state "schema" instead of database.
530
ERROR 3D000: No schema selected
1 by brian
clean slate
531
alter table test.t1 rename test.t1;
532
use test;
533
drop table t1;
1222.1.6 by Brian Aker
Fix engines to not rely on HA_CREATE_INFO.
534
CREATE TABLE t1(a INT) ROW_FORMAT=COMPACT;
1 by brian
clean slate
535
CREATE INDEX i1 ON t1(a);
536
SHOW CREATE TABLE t1;
537
Table	Create Table
352.2.1 by Harrison Fisk
Fix for bugs 259843 and 256482
538
t1	CREATE TABLE `t1` (
1743.5.2 by LinuxJedi
Alter many test cases for the new SHOW CREATE TABLE output
539
  `a` INT DEFAULT NULL,
2363.1.5 by Brian Aker
This patch fixes 798940, we will also just now add the type of index to our create statements.
540
  KEY `i1` (`a`) USING BTREE
1638.10.54 by Stewart Smith
alter_table.result: COLLATE and ENGINE in same line for SHOW CREATE TABLE
541
) ENGINE=DEFAULT ROW_FORMAT='COMPACT' COLLATE = utf8_general_ci
1 by brian
clean slate
542
DROP INDEX i1 ON t1;
543
SHOW CREATE TABLE t1;
544
Table	Create Table
352.2.1 by Harrison Fisk
Fix for bugs 259843 and 256482
545
t1	CREATE TABLE `t1` (
1743.5.2 by LinuxJedi
Alter many test cases for the new SHOW CREATE TABLE output
546
  `a` INT DEFAULT NULL
1638.10.54 by Stewart Smith
alter_table.result: COLLATE and ENGINE in same line for SHOW CREATE TABLE
547
) ENGINE=DEFAULT ROW_FORMAT='COMPACT' COLLATE = utf8_general_ci
1 by brian
clean slate
548
DROP TABLE t1;
549
DROP TABLE IF EXISTS bug24219;
550
DROP TABLE IF EXISTS bug24219_2;
551
CREATE TABLE bug24219 (a INT, INDEX(a));
552
SHOW INDEX FROM bug24219;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
553
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
554
bug24219	NO	a	1	a
1 by brian
clean slate
555
ALTER TABLE bug24219 RENAME TO bug24219_2, DISABLE KEYS;
201 by Brian Aker
Convert default engine to Innodb
556
Warnings:
557
Note	1031	Table storage engine for 'bug24219' doesn't have this option
1 by brian
clean slate
558
SHOW INDEX FROM bug24219_2;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
559
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
560
bug24219_2	NO	a	1	a
1 by brian
clean slate
561
DROP TABLE bug24219_2;
562
drop table if exists table_24562;
563
create table table_24562(
564
section int,
565
subsection int,
566
title varchar(50));
567
insert into table_24562 values
568
(1, 0, "Introduction"),
569
(1, 1, "Authors"),
570
(1, 2, "Acknowledgements"),
571
(2, 0, "Basics"),
572
(2, 1, "Syntax"),
573
(2, 2, "Client"),
574
(2, 3, "Server"),
575
(3, 0, "Intermediate"),
576
(3, 1, "Complex queries"),
577
(3, 2, "Stored Procedures"),
578
(3, 3, "Stored Functions"),
579
(4, 0, "Advanced"),
580
(4, 1, "Replication"),
581
(4, 2, "Load balancing"),
582
(4, 3, "High availability"),
583
(5, 0, "Conclusion");
584
select * from table_24562;
585
section	subsection	title
586
1	0	Introduction
587
1	1	Authors
588
1	2	Acknowledgements
589
2	0	Basics
590
2	1	Syntax
591
2	2	Client
592
2	3	Server
593
3	0	Intermediate
594
3	1	Complex queries
595
3	2	Stored Procedures
596
3	3	Stored Functions
597
4	0	Advanced
598
4	1	Replication
599
4	2	Load balancing
600
4	3	High availability
601
5	0	Conclusion
602
alter table table_24562 add column reviewer varchar(20),
603
order by title;
604
select * from table_24562;
605
section	subsection	title	reviewer
606
1	2	Acknowledgements	NULL
607
4	0	Advanced	NULL
608
1	1	Authors	NULL
609
2	0	Basics	NULL
610
2	2	Client	NULL
611
3	1	Complex queries	NULL
612
5	0	Conclusion	NULL
613
4	3	High availability	NULL
614
3	0	Intermediate	NULL
615
1	0	Introduction	NULL
616
4	2	Load balancing	NULL
617
4	1	Replication	NULL
618
2	3	Server	NULL
619
3	3	Stored Functions	NULL
620
3	2	Stored Procedures	NULL
621
2	1	Syntax	NULL
622
update table_24562 set reviewer="Me" where section=2;
623
update table_24562 set reviewer="You" where section=3;
624
alter table table_24562
625
order by section ASC, subsection DESC;
626
select * from table_24562;
627
section	subsection	title	reviewer
628
1	2	Acknowledgements	NULL
629
1	1	Authors	NULL
630
1	0	Introduction	NULL
631
2	3	Server	Me
632
2	2	Client	Me
633
2	1	Syntax	Me
634
2	0	Basics	Me
635
3	3	Stored Functions	You
636
3	2	Stored Procedures	You
637
3	1	Complex queries	You
638
3	0	Intermediate	You
639
4	3	High availability	NULL
640
4	2	Load balancing	NULL
641
4	1	Replication	NULL
642
4	0	Advanced	NULL
643
5	0	Conclusion	NULL
644
alter table table_24562
645
order by table_24562.subsection ASC, table_24562.section DESC;
646
select * from table_24562;
647
section	subsection	title	reviewer
648
5	0	Conclusion	NULL
649
4	0	Advanced	NULL
650
3	0	Intermediate	You
651
2	0	Basics	Me
652
1	0	Introduction	NULL
653
4	1	Replication	NULL
654
3	1	Complex queries	You
655
2	1	Syntax	Me
656
1	1	Authors	NULL
657
4	2	Load balancing	NULL
658
3	2	Stored Procedures	You
659
2	2	Client	Me
660
1	2	Acknowledgements	NULL
661
4	3	High availability	NULL
662
3	3	Stored Functions	You
663
2	3	Server	Me
664
alter table table_24562 order by 12;
629.2.6 by Monty
Updated test output with new and improved error messages.
665
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near '12' at line 1
1 by brian
clean slate
666
alter table table_24562 order by (section + 12);
629.2.6 by Monty
Updated test output with new and improved error messages.
667
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near '(section + 12)' at line 1
1 by brian
clean slate
668
alter table table_24562 order by length(title);
629.2.6 by Monty
Updated test output with new and improved error messages.
669
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near '(title)' at line 1
1 by brian
clean slate
670
alter table table_24562 order by no_such_col;
671
ERROR 42S22: Unknown column 'no_such_col' in 'order clause'
672
drop table table_24562;
223 by Brian Aker
Cleanup int() work.
673
create table t1 (mycol int not null);
1 by brian
clean slate
674
alter table t1 alter column mycol set default 0;
675
desc t1;
1309.4.3 by Brian Aker
Refactor DESC to use new table.
676
Field	Type	Null	Default	Default_is_NULL	On_Update
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
677
mycol	INTEGER	NO	0	NO	
1 by brian
clean slate
678
drop table t1;
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
679
create TEMPORARY table t1(id int primary key auto_increment) engine=MEMORY;
1 by brian
clean slate
680
insert into t1 values (null);
681
insert into t1 values (null);
682
select * from t1;
683
id
684
1
685
2
686
alter table t1 auto_increment = 50;
687
alter table t1 engine = myisam;
688
insert into t1 values (null);
689
select * from t1;
690
id
691
1
692
2
693
50
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
694
alter table t1 engine = MEMORY;
1 by brian
clean slate
695
insert into t1 values (null);
696
select * from t1;
697
id
698
1
699
2
700
50
701
51
702
drop table t1;
703
create table t1 (v varchar(32));
704
insert into t1 values ('def'),('abc'),('hij'),('3r4f');
705
select * from t1;
706
v
707
def
708
abc
709
hij
710
3r4f
711
alter table t1 change v v2 varchar(32);
712
select * from t1;
713
v2
714
def
715
abc
716
hij
717
3r4f
718
alter table t1 change v2 v varchar(64);
719
select * from t1;
720
v
721
def
722
abc
723
hij
724
3r4f
725
update t1 set v = 'lmn' where v = 'hij';
726
select * from t1;
727
v
728
def
729
abc
730
lmn
731
3r4f
732
alter table t1 add i int auto_increment not null primary key first;
733
select * from t1;
734
i	v
735
1	def
736
2	abc
737
3	lmn
738
4	3r4f
739
update t1 set i=5 where i=3;
740
select * from t1;
741
i	v
742
1	def
743
2	abc
201 by Brian Aker
Convert default engine to Innodb
744
4	3r4f
1 by brian
clean slate
745
5	lmn
746
alter table t1 change i i bigint;
747
select * from t1;
748
i	v
749
1	def
750
2	abc
201 by Brian Aker
Convert default engine to Innodb
751
4	3r4f
1 by brian
clean slate
752
5	lmn
753
alter table t1 add unique key (i, v);
754
select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn');
755
i	v
756
4	3r4f
757
drop table t1;
1063.9.3 by Brian Aker
Partial fix for tests for tmp
758
create TEMPORARY table t1 (t varchar(255) default null, key t (t(80))) engine=myisam;
1 by brian
clean slate
759
alter table t1 change t t text;
760
drop table t1;
1217 by Brian Aker
Removed bits of charset support from the parser.
761
CREATE TABLE t1 (s CHAR(8));
1 by brian
clean slate
762
INSERT INTO t1 VALUES ('test');
763
SELECT LENGTH(s) FROM t1;
764
LENGTH(s)
765
4
1217 by Brian Aker
Removed bits of charset support from the parser.
766
ALTER TABLE t1 MODIFY s CHAR(10);
1 by brian
clean slate
767
SELECT LENGTH(s) FROM t1;
768
LENGTH(s)
769
4
770
DROP TABLE t1;
233 by Brian Aker
Fix to remove binary/nchar
771
CREATE TABLE t1 (s varbinary(8));
1 by brian
clean slate
772
INSERT INTO t1 VALUES ('test');
773
SELECT LENGTH(s) FROM t1;
774
LENGTH(s)
233 by Brian Aker
Fix to remove binary/nchar
775
4
776
SELECT HEX(s) FROM t1;
777
HEX(s)
778
74657374
779
ALTER TABLE t1 MODIFY s varbinary(10);
780
SELECT HEX(s) FROM t1;
781
HEX(s)
782
74657374
1 by brian
clean slate
783
SELECT LENGTH(s) FROM t1;
784
LENGTH(s)
233 by Brian Aker
Fix to remove binary/nchar
785
4
1 by brian
clean slate
786
DROP TABLE t1;
787
CREATE TABLE t1 (v VARCHAR(3), b INT);
788
INSERT INTO t1 VALUES ('abc', 5);
789
SELECT * FROM t1;
790
v	b
791
abc	5
792
ALTER TABLE t1 MODIFY COLUMN v VARCHAR(4);
793
SELECT * FROM t1;
794
v	b
795
abc	5
796
DROP TABLE t1;
797
End of 5.0 tests
798
DROP TABLE IF EXISTS `t+1`, `t+2`;
799
CREATE TABLE `t+1` (c1 INT);
800
ALTER TABLE  `t+1` RENAME `t+2`;
801
CREATE TABLE `t+1` (c1 INT);
802
ALTER TABLE  `t+1` RENAME `t+2`;
1395.1.2 by Brian Aker
More logic pulling from ALTER TABLE
803
ERROR 42S01: Table 'test.t+2' already exists
1 by brian
clean slate
804
DROP TABLE   `t+1`, `t+2`;
805
CREATE TEMPORARY TABLE `tt+1` (c1 INT);
806
ALTER TABLE  `tt+1` RENAME `tt+2`;
807
CREATE TEMPORARY TABLE `tt+1` (c1 INT);
808
ALTER TABLE  `tt+1` RENAME `tt+2`;
1395.1.6 by Brian Aker
Modified TableIdentifier output for errors.
809
ERROR 42S01: Table 'test.#tt+2' already exists
1 by brian
clean slate
810
SHOW CREATE TABLE `tt+1`;
811
Table	Create Table
352.2.1 by Harrison Fisk
Fix for bugs 259843 and 256482
812
tt+1	CREATE TEMPORARY TABLE `tt+1` (
1743.5.2 by LinuxJedi
Alter many test cases for the new SHOW CREATE TABLE output
813
  `c1` INT DEFAULT NULL
1638.10.54 by Stewart Smith
alter_table.result: COLLATE and ENGINE in same line for SHOW CREATE TABLE
814
) ENGINE=DEFAULT COLLATE = utf8_general_ci
1 by brian
clean slate
815
SHOW CREATE TABLE `tt+2`;
816
Table	Create Table
352.2.1 by Harrison Fisk
Fix for bugs 259843 and 256482
817
tt+2	CREATE TEMPORARY TABLE `tt+2` (
1743.5.2 by LinuxJedi
Alter many test cases for the new SHOW CREATE TABLE output
818
  `c1` INT DEFAULT NULL
1638.10.54 by Stewart Smith
alter_table.result: COLLATE and ENGINE in same line for SHOW CREATE TABLE
819
) ENGINE=DEFAULT COLLATE = utf8_general_ci
1 by brian
clean slate
820
DROP TABLE   `tt+1`, `tt+2`;
821
CREATE TEMPORARY TABLE `#sql1` (c1 INT);
822
CREATE TEMPORARY TABLE `@0023sql2` (c1 INT);
823
SHOW TABLES;
824
Tables_in_test
1273.19.10 by Brian Aker
Add support for listing temporay tables from show commands.
825
#sql1
826
@0023sql2
1 by brian
clean slate
827
ALTER TABLE `#sql1`      RENAME `@0023sql1`;
828
ALTER TABLE `@0023sql2`  RENAME `#sql2`;
829
SHOW TABLES;
830
Tables_in_test
1273.19.10 by Brian Aker
Add support for listing temporay tables from show commands.
831
#sql2
832
@0023sql1
1 by brian
clean slate
833
INSERT INTO `#sql2`      VALUES (1);
834
INSERT INTO `@0023sql1`  VALUES (2);
835
SHOW CREATE TABLE `#sql2`;
836
Table	Create Table
352.2.1 by Harrison Fisk
Fix for bugs 259843 and 256482
837
#sql2	CREATE TEMPORARY TABLE `#sql2` (
1743.5.2 by LinuxJedi
Alter many test cases for the new SHOW CREATE TABLE output
838
  `c1` INT DEFAULT NULL
1638.10.54 by Stewart Smith
alter_table.result: COLLATE and ENGINE in same line for SHOW CREATE TABLE
839
) ENGINE=DEFAULT COLLATE = utf8_general_ci
1 by brian
clean slate
840
SHOW CREATE TABLE `@0023sql1`;
841
Table	Create Table
352.2.1 by Harrison Fisk
Fix for bugs 259843 and 256482
842
@0023sql1	CREATE TEMPORARY TABLE `@0023sql1` (
1743.5.2 by LinuxJedi
Alter many test cases for the new SHOW CREATE TABLE output
843
  `c1` INT DEFAULT NULL
1638.10.54 by Stewart Smith
alter_table.result: COLLATE and ENGINE in same line for SHOW CREATE TABLE
844
) ENGINE=DEFAULT COLLATE = utf8_general_ci
1 by brian
clean slate
845
DROP TABLE `#sql2`, `@0023sql1`;
846
DROP TABLE IF EXISTS t1;
847
DROP TABLE IF EXISTS t2;
848
CREATE TABLE t1 (
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
849
int_field INTEGER NOT NULL,
1 by brian
clean slate
850
char_field CHAR(10),
851
INDEX(`int_field`)
852
);
853
DESCRIBE t1;
1309.4.3 by Brian Aker
Refactor DESC to use new table.
854
Field	Type	Null	Default	Default_is_NULL	On_Update
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
855
int_field	INTEGER	NO		NO	
856
char_field	VARCHAR	YES		YES	
1 by brian
clean slate
857
SHOW INDEXES FROM t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
858
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
859
t1	NO	int_field	1	int_field
1 by brian
clean slate
860
INSERT INTO t1 VALUES (1, "edno"), (1, "edno"), (2, "dve"), (3, "tri"), (5, "pet");
861
"Non-copy data change - new frm, but old data and index files"
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
862
ALTER TABLE t1 CHANGE int_field unsigned_int_field INTEGER NOT NULL, RENAME t2;
1 by brian
clean slate
863
SELECT * FROM t1 ORDER BY int_field;
2140.1.3 by Brian Aker
Merge in error message fix for just one type of error for unknown table.
864
ERROR 42S02: Unknown table 'test.t1'
1 by brian
clean slate
865
SELECT * FROM t2 ORDER BY unsigned_int_field;
866
unsigned_int_field	char_field
867
1	edno
868
1	edno
869
2	dve
870
3	tri
871
5	pet
872
DESCRIBE t2;
1309.4.3 by Brian Aker
Refactor DESC to use new table.
873
Field	Type	Null	Default	Default_is_NULL	On_Update
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
874
unsigned_int_field	INTEGER	NO		NO	
875
char_field	VARCHAR	YES		YES	
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
876
DESCRIBE t2;
1309.4.3 by Brian Aker
Refactor DESC to use new table.
877
Field	Type	Null	Default	Default_is_NULL	On_Update
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
878
unsigned_int_field	INTEGER	NO		NO	
879
char_field	VARCHAR	YES		YES	
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
880
ALTER TABLE t2 MODIFY unsigned_int_field BIGINT NOT NULL;
881
DESCRIBE t2;
1309.4.3 by Brian Aker
Refactor DESC to use new table.
882
Field	Type	Null	Default	Default_is_NULL	On_Update
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
883
unsigned_int_field	BIGINT	NO		NO	
884
char_field	VARCHAR	YES		YES	
1 by brian
clean slate
885
DROP TABLE t2;
886
CREATE TABLE t1 (f1 INT, f2 INT, f3 INT);
887
INSERT INTO t1 VALUES (1, 2, NULL);
888
SELECT * FROM t1;
889
f1	f2	f3
890
1	2	NULL
891
ALTER TABLE t1 MODIFY COLUMN f3 INT AFTER f1;
892
SELECT * FROM t1;
893
f1	f3	f2
894
1	NULL	2
895
ALTER TABLE t1 MODIFY COLUMN f3 INT AFTER f2;
896
SELECT * FROM t1;
897
f1	f2	f3
898
1	2	NULL
899
DROP TABLE t1;