77
92
create temporary table t1 (a int not null);
78
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
79
93
show create table t1;
80
94
alter table t1 rename t2;
81
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
82
95
show create table t2;
99
test_set set( 'val1', 'val2', 'val3' ) not null default '',
86
100
name char(20) default 'O''Brien' comment 'O''Brien as default',
87
101
c int not null comment 'int column',
88
102
`c-b` int comment 'name with a minus',
89
103
`space 2` int comment 'name with a space'
90
104
) comment = 'it\'s a table' ;
91
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
105
show create table t1;
106
set sql_quote_show_create=0;
107
show create table t1;
108
set sql_quote_show_create=1;
109
show full columns from t1;
96
112
create table t1 (a int not null, unique aa (a));
97
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
98
113
show create table t1;
100
115
create table t1 (a int not null, primary key (a));
101
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
102
show create table t1;
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;
109
ALTER TABLE t1 COMMENT="", ROW_FORMAT=default;
116
show create table t1;
121
create table t1(n int);
122
insert into t1 values (1);
126
create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" ENGINE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed;
127
show create table t1;
128
alter table t1 MAX_ROWS=200 ROW_FORMAT=dynamic PACK_KEYS=0;
129
show create table t1;
130
ALTER TABLE t1 AVG_ROW_LENGTH=0 CHECKSUM=0 COMMENT="" MIN_ROWS=0 MAX_ROWS=0 PACK_KEYS=DEFAULT DELAY_KEY_WRITE=0 ROW_FORMAT=default;
110
131
show create table t1;
113
134
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
135
show columns from t1;
115
show columns from t1;
136
show full columns from t1;
119
140
# Do a create table that tries to cover all types and options
121
create temporary table t1 (
143
type_bool bool not null default 0,
144
type_tiny int not null auto_increment primary key,
146
type_mediumint mediumint,
123
147
type_bigint bigint,
124
148
type_decimal decimal(5,2),
125
149
type_numeric numeric(5,2),
127
151
type_char char(2),
128
152
type_varchar varchar(10),
129
153
type_timestamp timestamp not null,
131
type_datetime datetime,
154
type_date date not null default '0000-00-00',
155
type_time time not null default '00:00:00',
156
type_datetime datetime not null default '0000-00-00 00:00:00',
132
158
type_enum enum ('red', 'green', 'blue'),
133
159
type_set enum ('red', 'green', 'blue'),
160
type_tinyblob tinyblob,
136
) COMMENT="test" ENGINE=MYISAM ROW_FORMAT=fixed;
162
type_medium_blob mediumblob,
163
type_long_blob longblob,
165
) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" ENGINE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed CHARSET=latin1;
138
167
# Not tested above: RAID_# UNION INSERT_METHOD DATA DIRECTORY INDEX DIRECTORY
139
168
show create table t1;
166
195
CREATE TABLE ```ab``cd``` (i INT);
167
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
168
196
SHOW CREATE TABLE ```ab``cd```;
169
197
DROP TABLE ```ab``cd```;
171
199
CREATE TABLE ```ab````cd``` (i INT);
172
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
173
200
SHOW CREATE TABLE ```ab````cd```;
174
201
DROP TABLE ```ab````cd```;
176
203
CREATE TABLE ```a` (i INT);
177
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
178
204
SHOW CREATE TABLE ```a`;
179
205
DROP TABLE ```a`;
181
207
CREATE TABLE `a.1` (i INT);
182
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
183
208
SHOW CREATE TABLE `a.1`;
184
209
DROP TABLE `a.1`;
188
# Test for bug #2719 "MEMORY tables status shows wrong or missing data."
213
# Test for bug #2719 "Heap tables status shows wrong or missing data."
191
216
select @@max_heap_table_size;
193
CREATE TEMPORARY TABLE t1 (
219
a int(11) default NULL,
195
220
KEY a USING BTREE (a)
198
CREATE TEMPORARY TABLE t2 (
224
b int(11) default NULL,
203
CREATE TEMPORARY TABLE t3 (
229
a int(11) default NULL,
230
b int(11) default NULL,
206
231
KEY a USING BTREE (a),
210
235
insert into t1 values (1),(2);
211
236
insert into t2 values (1),(2);
212
237
insert into t3 values (1,1),(2,2);
213
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
238
--replace_column 6 # 7 # 8 # 9 #
214
239
show table status;
215
240
insert into t1 values (3),(4);
216
241
insert into t2 values (3),(4);
217
242
insert into t3 values (3,3),(4,4);
218
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
243
--replace_column 6 # 7 # 8 # 9 #
219
244
show table status;
220
245
insert into t1 values (5);
221
246
insert into t2 values (5);
222
247
insert into t3 values (5,5);
223
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
248
--replace_column 6 # 7 # 8 # 9 #
224
249
show table status;
225
250
delete from t1 where a=3;
226
251
delete from t2 where b=3;
227
252
delete from t3 where a=3;
228
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
253
--replace_column 6 # 7 # 8 # 9 # 10 #
229
254
show table status;
230
255
truncate table t1;
231
256
truncate table t2;
232
257
truncate table t3;
233
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
258
--replace_column 6 # 7 # 8 # 9 #
234
259
show table status;
235
260
insert into t1 values (5);
236
261
insert into t2 values (5);
237
262
insert into t3 values (5,5);
238
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
263
--replace_column 6 # 7 # 8 # 9 #
239
264
show table status;
240
265
delete from t1 where a=5;
241
266
delete from t2 where b=5;
242
267
delete from t3 where a=5;
243
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
268
--replace_column 6 # 7 # 8 # 9 # 10 #
244
269
show table status;
246
271
drop table t1, t2, t3;
248
273
# Test that USING <keytype> is always shown in SHOW CREATE TABLE when it was
249
274
# specified during table creation, but not otherwise. (Bug #7235)
250
CREATE TEMPORARY TABLE t1 (i int, KEY (i)) ENGINE=MEMORY;
251
SHOW CREATE TABLE t1;
253
CREATE TEMPORARY TABLE t1 (i int, KEY USING HASH (i)) ENGINE=MEMORY;
254
SHOW CREATE TABLE t1;
256
CREATE TEMPORARY TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MEMORY;
257
SHOW CREATE TABLE t1;
259
CREATE TEMPORARY TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
260
SHOW CREATE TABLE t1;
262
CREATE TEMPORARY TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
275
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MEMORY;
276
SHOW CREATE TABLE t1;
278
CREATE TABLE t1 (i int, KEY USING HASH (i)) ENGINE=MEMORY;
279
SHOW CREATE TABLE t1;
281
CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MEMORY;
282
SHOW CREATE TABLE t1;
284
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
285
SHOW CREATE TABLE t1;
287
CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
263
288
SHOW CREATE TABLE t1;
265
290
# Test that when an index is created with the default key algorithm and
266
291
# altered to another storage engine, it gets the default key algorithm
267
292
# for that storage engine, but when it is specified, the specified type is
269
CREATE TEMPORARY TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
294
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
270
295
SHOW CREATE TABLE t1;
271
296
ALTER TABLE t1 ENGINE=MEMORY;
272
297
SHOW CREATE TABLE t1;
274
CREATE TEMPORARY TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
299
CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
275
300
SHOW CREATE TABLE t1;
276
301
ALTER TABLE t1 ENGINE=MEMORY;
277
302
SHOW CREATE TABLE t1;
294
319
PRIMARY KEY USING HASH (c1),
295
320
INDEX USING BTREE(c2)
297
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
298
322
SHOW CREATE TABLE t1;
325
# Test for BUG#93: 4.1 protocl crash on corupted frm and SHOW TABLE STATUS
329
# Create a junk frm file on disk
330
system echo "this is a junk file for test" >> $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
331
--replace_column 6 # 7 # 8 # 9 #
332
SHOW TABLE STATUS like 't1';
334
show create table t1;
335
drop table if exists t1;
337
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
340
# BUG 12183 - SHOW OPEN TABLES behavior doesn't match grammar
341
# First we close all open tables with FLUSH tables and then we open some.
345
--echo # Bug#12183: SHOW OPEN TABLES behavior doesn't match grammar.
348
# NOTE: SHOW OPEN TABLES does not sort result list by database or table names.
349
# Tables are listed in the order they were opened. We can not use the system
350
# database (mysql) for the test here, because we have no control over the order
351
# of opening tables in it. Consequently, we can not use 'SHOW OPEN TABLES'.
354
DROP DATABASE IF EXISTS mysqltest1;
357
CREATE DATABASE mysqltest1;
362
CREATE TABLE t1(a INT);
363
CREATE TABLE t2(a INT);
367
--disable_ps_protocol
377
SHOW OPEN TABLES FROM mysqltest1;
381
SHOW OPEN TABLES FROM mysqltest1 LIKE 'z%';
385
SHOW OPEN TABLES FROM mysqltest1 LIKE 't1%';
389
SHOW OPEN TABLES FROM mysqltest1 LIKE '%1%';
398
DROP DATABASE mysqltest1;
302
404
# BUG #12591 (SHOW TABLES FROM dbname produces wrong error message)
304
--error ER_BAD_DB_ERROR
305
407
SHOW TABLES FROM non_existing_database;
307
409
--echo End of 4.1 tests
313
415
--error ER_BAD_DB_ERROR
314
416
SHOW TABLES FROM no_such_database;
315
--error ER_TABLE_UNKNOWN
417
--error ER_NO_SUCH_TABLE
316
418
SHOW COLUMNS FROM no_such_table;
422
# Bug #28808: log_queries_not_using_indexes variable dynamic change is ignored
425
show variables like "log_queries_not_using_indexes";
426
select 1 from information_schema.tables limit 1;
427
show status like 'slow_queries';
428
set global log_queries_not_using_indexes=OFF;
429
show variables like "log_queries_not_using_indexes";
430
select 1 from information_schema.tables limit 1;
431
show status like 'slow_queries';
432
set global log_queries_not_using_indexes=ON;
433
show variables like "log_queries_not_using_indexes";
434
select 1 from information_schema.tables limit 1;
435
show status like 'slow_queries';
319
438
# Bug #30088: Can't disable myisam-recover by a value of ""
336
468
drop database `mysqlttest\1`;
339
# Bug#25081 show TABLES on table with latin chars in name fails
471
# Bug#24392: SHOW ENGINE MUTEX STATUS is a synonym for SHOW INNODB STATUS
474
--error ER_UNKNOWN_STORAGE_ENGINE
475
show engine foobar status;
476
--error ER_UNKNOWN_STORAGE_ENGINE
477
show engine foobar logs;
478
--error ER_UNKNOWN_STORAGE_ENGINE
479
show engine foobar mutex;
481
--error ER_UNKNOWN_STORAGE_ENGINE
482
show engine mutex status;
484
show engine csv status;
485
show engine csv logs;
486
show engine csv mutex;
488
# Bug#25081 SHOW FULL TABLES on table with latin chars in name fails
341
491
--disable_warnings
342
492
drop table if exists `été`;
343
493
--enable_warnings
344
494
create table `été` (field1 int);
346
496
drop table `été`;
349
500
# Bug#26402 Server crashes with old-style named table
351
--error ER_TABLE_UNKNOWN,ER_FILE_NOT_FOUND
502
--error ER_NO_SUCH_TABLE,ER_FILE_NOT_FOUND
352
503
show columns from `#mysql50#????????`;
355
# Test error output for SHOW engine_name STATUS
357
--error ER_USE_DATA_DICTIONARY
360
505
--echo End of 5.1 tests