~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
#
2
# Test of some show commands
3
#
4
5
--disable_warnings
6
drop table if exists t1,t2;
7
drop table if exists t1aa,t2aa;
8
drop database if exists mysqltest;
9
drop database if exists mysqltest1;
10
11
--enable_warnings
12
13
create table t1 (a int not null primary key, b int not null,c int not null, key(b,c));
14
insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4);
15
16
--echo -- Here we enable metadata just to check that the collation of the
17
--echo -- resultset is non-binary for string type. This should be changed
18
--echo -- after Bug#29394 is implemented.
19
20
--enable_metadata
1222.1.10 by Brian Aker
Removes options from DDL left in Cursor for admin operations (they were
21
check table t1;
1 by brian
clean slate
22
insert into t1 values (5,5,5);
1222.1.10 by Brian Aker
Removes options from DDL left in Cursor for admin operations (they were
23
check table t1;
1 by brian
clean slate
24
show index from t1;
25
--disable_metadata
26
--error ER_DUP_ENTRY
27
insert into t1 values (5,5,5);
28
29
--echo -- Here we enable metadata just to check that the collation of the
30
--echo -- resultset is non-binary for string type. This should be changed
31
--echo -- after Bug#29394 is implemented.
32
33
--enable_metadata
1222.1.14 by Brian Aker
Remove OPTIMIZE, place in ALTER TABLE (which does the same thing).
34
alter table t1 engine="default";
1 by brian
clean slate
35
--disable_metadata
1222.1.14 by Brian Aker
Remove OPTIMIZE, place in ALTER TABLE (which does the same thing).
36
alter table t1 engine="default";
1 by brian
clean slate
37
drop table t1;
38
39
#show variables;
40
41
--echo -- Here we enable metadata just to check that the collation of the
42
--echo -- resultset is non-binary for string type. This should be changed
43
--echo -- after Bug#29394 is implemented.
44
45
--enable_metadata
971.3.62 by Eric Day
Fixed test that depended on wait_timeout. This was a random system var, so I switched to server_id.
46
show variables like "server_id%";
47
show variables like "SERVER_id%";
1 by brian
clean slate
48
show variables like "this_doesn't_exists%";
1320.1.18 by Brian Aker
Overhaul of SHOW TABLE STATUS.
49
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
1 by brian
clean slate
50
show table status from test like "this_doesn't_exists%";
51
show databases;
52
show databases like "test%";
53
--disable_metadata
54
55
#
56
# Check of show index
57
#
58
create table t1 (f1 int not null, f2 int not null, f3 int not null, f4 int not null, primary key(f1,f2,f3,f4));
59
insert into t1 values (1,1,1,0),(1,1,2,0),(1,1,3,0),(1,2,1,0),(1,2,2,0),(1,2,3,0),(1,3,1,0),(1,3,2,0),(1,3,3,0),(1,1,1,1),(1,1,2,1),(1,1,3,1),(1,2,1,1),(1,2,2,1),(1,2,3,1),(1,3,1,1),(1,3,2,1),(1,3,3,1);
60
61
--echo -- Here we enable metadata just to check that the collation of the
62
--echo -- resultset is non-binary for string type. This should be changed
63
--echo -- after Bug#29394 is implemented.
64
65
--enable_metadata
66
analyze table t1;
67
--disable_metadata
68
show index from t1;
69
70
show index from t1;
71
drop table t1;
72
73
#
74
# Test of SHOW CREATE
75
#
76
77
create temporary table t1 (a int not null);
942.3.1 by Vladimir Kolesnikov
test generalizations
78
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1 by brian
clean slate
79
show create table t1;
80
alter table t1 rename t2;
942.3.1 by Vladimir Kolesnikov
test generalizations
81
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1 by brian
clean slate
82
show create table t2;
83
drop table t2;
84
85
create table t1 (
86
  name char(20) default 'O''Brien' comment 'O''Brien as default',
87
  c int not null comment 'int column',
88
  `c-b` int comment 'name with a minus',
89
  `space 2` int comment 'name with a space'
90
  ) comment = 'it\'s a table' ;
942.3.1 by Vladimir Kolesnikov
test generalizations
91
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1 by brian
clean slate
92
show create table t1;
1273.13.37 by Brian Aker
Remove "full" syntax.
93
show columns from t1;
1 by brian
clean slate
94
drop table t1;
95
96
create table t1 (a int not null, unique aa (a));
942.3.1 by Vladimir Kolesnikov
test generalizations
97
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1 by brian
clean slate
98
show create table t1;
99
drop table t1;
100
create table t1 (a int not null, primary key (a));
942.3.1 by Vladimir Kolesnikov
test generalizations
101
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1 by brian
clean slate
102
show create table t1;
103
drop table t1;
104
1117.1.9 by Brian Aker
Merge my branch from Stewart into one branch
105
create temporary table t1 (a int not null, b VARCHAR(10), INDEX (b) ) COMMENT="test" ENGINE=MYISAM ROW_FORMAT=fixed;
106
show create table t1;
107
alter table t1 ROW_FORMAT=dynamic;
108
show create table t1;
2029.1.23 by Brian Aker
Shuffle ROW_FORMAT.
109
ALTER TABLE t1 COMMENT="", ROW_FORMAT=default;
1 by brian
clean slate
110
show create table t1;
111
drop table t1;
112
113
create table t1 (a decimal(9,2), b decimal (9,0), e double(9,2), f double(5,0), h float(3,2), i float(3,0));
114
show columns from t1;
1273.13.37 by Brian Aker
Remove "full" syntax.
115
show columns from t1;
1 by brian
clean slate
116
drop table t1;
117
118
#
119
# Do a create table that tries to cover all types and options
120
#
1063.9.26 by Stewart Smith
show_check.test for MyISAM as temp table only.
121
create temporary table t1 (
673.3.27 by Stewart Smith
fix CREATE statements in show_check test. Add new (broken) frm test for use in future frm work.
122
type_int int,
1 by brian
clean slate
123
type_bigint bigint,
124
type_decimal decimal(5,2),
125
type_numeric numeric(5,2),
126
empty_char char(0),
127
type_char char(2),
128
type_varchar varchar(10),
129
type_timestamp timestamp not null,
873.1.1 by Jay Pipes
Fixes the Field_date class to not allow any invalid input at
130
type_date date,
873.1.2 by Jay Pipes
Fixed Field_datetime to never accept any bad datetimes as a string. This broke
131
type_datetime datetime,
1 by brian
clean slate
132
type_enum enum ('red', 'green', 'blue'),
133
type_set enum ('red', 'green', 'blue'),
134
type_blob blob,
673.3.27 by Stewart Smith
fix CREATE statements in show_check test. Add new (broken) frm test for use in future frm work.
135
index(type_int)
1117.1.9 by Brian Aker
Merge my branch from Stewart into one branch
136
) COMMENT="test" ENGINE=MYISAM ROW_FORMAT=fixed;
1 by brian
clean slate
137
138
# Not tested above: RAID_# UNION INSERT_METHOD DATA DIRECTORY INDEX DIRECTORY
139
show create table t1;
140
insert into t1 (type_timestamp) values ("2003-02-07 10:00:01");
141
select * from t1;
142
drop table t1;
143
144
#
145
# Check metadata
146
#
147
create table t1 (a int not null);
148
create table t2 select max(a) from t1;
149
show columns from t2;
150
drop table t1,t2;
151
152
# Check auto conversions of types
153
154
create table t1 (c decimal, d double, f float, r real);
155
show columns from t1;
156
drop table t1;
157
158
create table t1 (c decimal(3,3), d double(3,3), f float(3,3));
159
show columns from t1;
160
drop table t1;
161
162
#
163
# Test for Bug #2593 "SHOW CREATE TABLE doesn't properly double quotes"
164
#
165
166
CREATE TABLE ```ab``cd``` (i INT);
942.3.1 by Vladimir Kolesnikov
test generalizations
167
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1 by brian
clean slate
168
SHOW CREATE TABLE ```ab``cd```;
169
DROP TABLE ```ab``cd```;
170
171
CREATE TABLE ```ab````cd``` (i INT);
942.3.1 by Vladimir Kolesnikov
test generalizations
172
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1 by brian
clean slate
173
SHOW CREATE TABLE ```ab````cd```;
174
DROP TABLE ```ab````cd```;
175
176
CREATE TABLE ```a` (i INT);
942.3.1 by Vladimir Kolesnikov
test generalizations
177
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1 by brian
clean slate
178
SHOW CREATE TABLE ```a`;
179
DROP TABLE ```a`;
180
181
CREATE TABLE `a.1` (i INT);
942.3.1 by Vladimir Kolesnikov
test generalizations
182
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1 by brian
clean slate
183
SHOW CREATE TABLE `a.1`;
184
DROP TABLE `a.1`;
185
186
187
#
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
188
# Test for bug #2719 "MEMORY tables status shows wrong or missing data."
1 by brian
clean slate
189
#
190
191
select @@max_heap_table_size;
192
1106.3.1 by Brian Aker
Heap is now tmp only table
193
CREATE TEMPORARY TABLE t1 (
673.3.27 by Stewart Smith
fix CREATE statements in show_check test. Add new (broken) frm test for use in future frm work.
194
 a int default NULL,
1 by brian
clean slate
195
 KEY a USING BTREE (a)
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
196
) ENGINE=MEMORY;
1 by brian
clean slate
197
1106.3.1 by Brian Aker
Heap is now tmp only table
198
CREATE TEMPORARY TABLE t2 (
673.3.27 by Stewart Smith
fix CREATE statements in show_check test. Add new (broken) frm test for use in future frm work.
199
 b int default NULL,
1 by brian
clean slate
200
 index(b)
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
201
) ENGINE=MEMORY;
1 by brian
clean slate
202
1106.3.1 by Brian Aker
Heap is now tmp only table
203
CREATE TEMPORARY TABLE t3 (
673.3.27 by Stewart Smith
fix CREATE statements in show_check test. Add new (broken) frm test for use in future frm work.
204
 a int default NULL,
205
 b int default NULL,
1 by brian
clean slate
206
 KEY a USING BTREE (a),
207
 index(b)
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
208
) ENGINE=MEMORY;
1 by brian
clean slate
209
210
insert into t1 values (1),(2);
211
insert into t2 values (1),(2);
212
insert into t3 values (1,1),(2,2);
1320.1.18 by Brian Aker
Overhaul of SHOW TABLE STATUS.
213
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
1 by brian
clean slate
214
show table status;
215
insert into t1 values (3),(4);
216
insert into t2 values (3),(4);
217
insert into t3 values (3,3),(4,4);
1320.1.18 by Brian Aker
Overhaul of SHOW TABLE STATUS.
218
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
1 by brian
clean slate
219
show table status;
220
insert into t1 values (5);
221
insert into t2 values (5);
222
insert into t3 values (5,5);
1320.1.18 by Brian Aker
Overhaul of SHOW TABLE STATUS.
223
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
1 by brian
clean slate
224
show table status;
225
delete from t1 where a=3;
226
delete from t2 where b=3;
227
delete from t3 where a=3;
1320.1.18 by Brian Aker
Overhaul of SHOW TABLE STATUS.
228
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
1 by brian
clean slate
229
show table status;
230
truncate table t1;
231
truncate table t2;
232
truncate table t3;
1320.1.18 by Brian Aker
Overhaul of SHOW TABLE STATUS.
233
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
1 by brian
clean slate
234
show table status;
235
insert into t1 values (5);
236
insert into t2 values (5);
237
insert into t3 values (5,5);
1320.1.18 by Brian Aker
Overhaul of SHOW TABLE STATUS.
238
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
1 by brian
clean slate
239
show table status;
240
delete from t1 where a=5;
241
delete from t2 where b=5;
242
delete from t3 where a=5;
1320.1.18 by Brian Aker
Overhaul of SHOW TABLE STATUS.
243
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
1 by brian
clean slate
244
show table status;
245
246
drop table t1, t2, t3;
247
248
# Test that USING <keytype> is always shown in SHOW CREATE TABLE when it was
249
# specified during table creation, but not otherwise. (Bug #7235)
1106.3.1 by Brian Aker
Heap is now tmp only table
250
CREATE TEMPORARY TABLE t1 (i int, KEY (i)) ENGINE=MEMORY;
251
SHOW CREATE TABLE t1;
252
DROP TABLE t1;
253
CREATE TEMPORARY TABLE t1 (i int, KEY USING HASH (i)) ENGINE=MEMORY;
254
SHOW CREATE TABLE t1;
255
DROP TABLE t1;
256
CREATE TEMPORARY TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MEMORY;
1 by brian
clean slate
257
SHOW CREATE TABLE t1;
258
DROP TABLE t1;
1063.9.26 by Stewart Smith
show_check.test for MyISAM as temp table only.
259
CREATE TEMPORARY TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
1 by brian
clean slate
260
SHOW CREATE TABLE t1;
261
DROP TABLE t1;
1063.9.26 by Stewart Smith
show_check.test for MyISAM as temp table only.
262
CREATE TEMPORARY TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
1 by brian
clean slate
263
SHOW CREATE TABLE t1;
264
DROP TABLE t1;
265
# Test that when an index is created with the default key algorithm and
266
# altered to another storage engine, it gets the default key algorithm
267
# for that storage engine, but when it is specified, the specified type is
268
# preserved.
1063.9.26 by Stewart Smith
show_check.test for MyISAM as temp table only.
269
CREATE TEMPORARY TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
1 by brian
clean slate
270
SHOW CREATE TABLE t1;
271
ALTER TABLE t1 ENGINE=MEMORY;
272
SHOW CREATE TABLE t1;
273
DROP TABLE t1;
1063.9.26 by Stewart Smith
show_check.test for MyISAM as temp table only.
274
CREATE TEMPORARY TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
1 by brian
clean slate
275
SHOW CREATE TABLE t1;
276
ALTER TABLE t1 ENGINE=MEMORY;
277
SHOW CREATE TABLE t1;
278
DROP TABLE t1;
279
280
# Test for BUG#9439 "Reporting wrong datatype for sub_part on show index"
281
CREATE TABLE t1(
282
  field1 text NOT NULL,
673.3.27 by Stewart Smith
fix CREATE statements in show_check test. Add new (broken) frm test for use in future frm work.
283
  PRIMARY KEY(field1(180))
1 by brian
clean slate
284
);
285
--enable_metadata
286
show index from t1;
287
--disable_metadata
288
drop table t1;
289
290
# Test for BUG#11635: mysqldump exports TYPE instead of USING for HASH
291
create table t1 (
292
  c1 int NOT NULL,
293
  c2 int NOT NULL,
294
  PRIMARY KEY USING HASH (c1),
295
  INDEX USING BTREE(c2)
296
);
942.3.1 by Vladimir Kolesnikov
test generalizations
297
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1 by brian
clean slate
298
SHOW CREATE TABLE t1;
299
DROP TABLE t1;
300
301
#
302
# BUG #12591 (SHOW TABLES FROM dbname produces wrong error message)
303
#
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
304
--error ER_BAD_DB_ERROR
1 by brian
clean slate
305
SHOW TABLES FROM non_existing_database;
306
307
--echo End of 4.1 tests
308
309
#
310
# Check that SHOW TABLES and SHOW COLUMNS give a error if there is no
311
# referenced database and table respectively.
312
#
313
--error ER_BAD_DB_ERROR
314
SHOW TABLES FROM no_such_database;
2140.1.3 by Brian Aker
Merge in error message fix for just one type of error for unknown table.
315
--error ER_TABLE_UNKNOWN
1 by brian
clean slate
316
SHOW COLUMNS FROM no_such_table;
317
318
#
319
# Bug #30088: Can't disable myisam-recover by a value of ""
320
#
321
show variables like 'myisam_recover_options';
322
323
--echo End of 5.0 tests
324
325
#
326
# Bug #19874: SHOW COLUMNS and SHOW KEYS handle identifiers containing
327
# \ incorrectly
328
#
329
create database `mysqlttest\1`;
330
create table `mysqlttest\1`.`a\b` (a int);
331
show tables from `mysqlttest\1`;
332
show fields from `mysqlttest\1`.`a\b`;
333
show columns from `a\b` from `mysqlttest\1`;
334
show keys from `mysqlttest\1`.`a\b`;
335
drop table `mysqlttest\1`.`a\b`;
336
drop database `mysqlttest\1`;
337
338
#
1273.13.37 by Brian Aker
Remove "full" syntax.
339
# Bug#25081 show TABLES on table with latin chars in name fails
1 by brian
clean slate
340
#
341
--disable_warnings
342
drop table if exists `é`;
343
--enable_warnings
344
create table `é` (field1 int);
1273.13.37 by Brian Aker
Remove "full" syntax.
345
show tables;
1 by brian
clean slate
346
drop table `é`;
347
348
#
349
# Bug#26402 Server crashes with old-style named table
350
#
2140.1.3 by Brian Aker
Merge in error message fix for just one type of error for unknown table.
351
--error ER_TABLE_UNKNOWN,ER_FILE_NOT_FOUND
1 by brian
clean slate
352
show columns from `#mysql50#????????`;
353
2131.3.1 by Andrew Hutchings
Add error telling the user to use data_dictionary for SHOW engine_name STATUS
354
#
355
# Test error output for SHOW engine_name STATUS
356
#
357
--error ER_USE_DATA_DICTIONARY
358
show innodb status;
359
1 by brian
clean slate
360
--echo End of 5.1 tests