~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/show_check.test

  • Committer: Monty
  • Date: 2008-11-07 05:51:15 UTC
  • mto: This revision was merged to the branch mainline in revision 579.
  • Revision ID: mordred@palanthas.inaugust.com-20081107055115-0275gvq62buzls77
Fixed a decimal sign thing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# check that CSV engine was compiled in, as the result of the test
 
2
# depends on the presence of the log tables (which are CSV-based).
 
3
--source include/have_csv.inc
 
4
 
1
5
#
2
6
# Test of some show commands
3
7
#
18
22
--echo -- after Bug#29394 is implemented.
19
23
 
20
24
--enable_metadata
21
 
check table t1;
 
25
check table t1 fast;
 
26
check table t1 fast;
 
27
check table t1 changed;
22
28
insert into t1 values (5,5,5);
23
 
check table t1;
 
29
check table t1 changed;
 
30
check table t1 medium;
 
31
check table t1 extended;
24
32
show index from t1;
25
33
--disable_metadata
26
34
--error ER_DUP_ENTRY
31
39
--echo -- after Bug#29394 is implemented.
32
40
 
33
41
--enable_metadata
34
 
alter table t1 engine="default";
 
42
optimize table t1;
35
43
--disable_metadata
36
 
alter table t1 engine="default";
 
44
optimize table t1;
37
45
drop table t1;
38
46
 
39
47
#show variables;
43
51
--echo -- after Bug#29394 is implemented.
44
52
 
45
53
--enable_metadata
46
 
show variables like "server_id%";
47
 
show variables like "SERVER_id%";
 
54
show variables like "wait_timeout%";
 
55
show variables like "WAIT_timeout%";
48
56
show variables like "this_doesn't_exists%";
49
 
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
50
57
show table status from test like "this_doesn't_exists%";
51
58
show databases;
52
59
show databases like "test%";
67
74
--disable_metadata
68
75
show index from t1;
69
76
 
 
77
--echo -- Here we enable metadata just to check that the collation of the
 
78
--echo -- resultset is non-binary for string type. This should be changed
 
79
--echo -- after Bug#29394 is implemented.
 
80
 
 
81
--enable_metadata
 
82
 
 
83
repair table t1;
 
84
--disable_metadata
70
85
show index from t1;
71
86
drop table t1;
72
87
 
75
90
#
76
91
 
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;
83
96
drop table t2;
84
97
 
85
98
create table t1 (
 
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/
92
 
show create table t1;
93
 
show columns from t1;
 
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;
94
110
drop table t1;
95
111
 
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;
99
114
drop 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;
103
 
drop table t1;
104
 
 
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;
 
117
drop table t1;
 
118
 
 
119
flush tables;
 
120
show open tables;
 
121
create table t1(n int);
 
122
insert into t1 values (1);
 
123
show open tables;
 
124
drop table t1;
 
125
 
 
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;
111
132
drop table t1;
112
133
 
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;
116
137
drop table t1;
117
138
 
118
139
#
119
140
# Do a create table that tries to cover all types and options
120
141
#
121
 
create temporary table t1 (
122
 
type_int int,
 
142
create table t1 (
 
143
type_bool bool not null default 0,
 
144
type_tiny int not null auto_increment primary key,
 
145
type_short int(3),
 
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,
130
 
type_date date,
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',
 
157
type_year year,
132
158
type_enum enum ('red', 'green', 'blue'),
133
159
type_set enum ('red', 'green', 'blue'),
 
160
type_tinyblob tinyblob,
134
161
type_blob blob,
135
 
index(type_int)
136
 
) COMMENT="test" ENGINE=MYISAM ROW_FORMAT=fixed;
 
162
type_medium_blob mediumblob,
 
163
type_long_blob longblob,
 
164
index(type_short)
 
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;
137
166
 
138
167
# Not tested above: RAID_# UNION INSERT_METHOD DATA DIRECTORY INDEX DIRECTORY
139
168
show create table t1;
164
193
#
165
194
 
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```;
170
198
 
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```;
175
202
 
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`;
180
206
 
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`;
185
210
 
186
211
 
187
212
#
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."
189
214
#
190
215
 
191
216
select @@max_heap_table_size;
192
217
 
193
 
CREATE TEMPORARY TABLE t1 (
194
 
 a int default NULL,
 
218
CREATE TABLE t1 (
 
219
 a int(11) default NULL,
195
220
 KEY a USING BTREE (a)
196
 
) ENGINE=MEMORY;
 
221
) ENGINE=HEAP;
197
222
 
198
 
CREATE TEMPORARY TABLE t2 (
199
 
 b int default NULL,
 
223
CREATE TABLE t2 (
 
224
 b int(11) default NULL,
200
225
 index(b)
201
 
) ENGINE=MEMORY;
 
226
) ENGINE=HEAP;
202
227
 
203
 
CREATE TEMPORARY TABLE t3 (
204
 
 a int default NULL,
205
 
 b int default NULL,
 
228
CREATE TABLE t3 (
 
229
 a int(11) default NULL,
 
230
 b int(11) default NULL,
206
231
 KEY a USING BTREE (a),
207
232
 index(b)
208
 
) ENGINE=MEMORY;
 
233
) ENGINE=HEAP;
209
234
 
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;
245
270
 
246
271
drop table t1, t2, t3;
247
272
 
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;
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;
257
 
SHOW CREATE TABLE t1;
258
 
DROP TABLE t1;
259
 
CREATE TEMPORARY TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
260
 
SHOW CREATE TABLE t1;
261
 
DROP 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;
 
277
DROP TABLE t1;
 
278
CREATE TABLE t1 (i int, KEY USING HASH (i)) ENGINE=MEMORY;
 
279
SHOW CREATE TABLE t1;
 
280
DROP TABLE t1;
 
281
CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MEMORY;
 
282
SHOW CREATE TABLE t1;
 
283
DROP TABLE t1;
 
284
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
 
285
SHOW CREATE TABLE t1;
 
286
DROP TABLE t1;
 
287
CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
263
288
SHOW CREATE TABLE t1;
264
289
DROP 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
268
293
# preserved.
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;
273
298
DROP 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;
280
305
# Test for BUG#9439 "Reporting wrong datatype for sub_part on show index"
281
306
CREATE TABLE t1(
282
307
  field1 text NOT NULL,
283
 
  PRIMARY KEY(field1(180))
 
308
  PRIMARY KEY(field1(1000))
284
309
);
285
310
--enable_metadata
286
311
show index from t1;
294
319
  PRIMARY KEY USING HASH (c1),
295
320
  INDEX USING BTREE(c2)
296
321
);
297
 
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
298
322
SHOW CREATE TABLE t1;
299
323
DROP TABLE t1;
300
324
 
 
325
# Test for BUG#93: 4.1 protocl crash on corupted frm and SHOW TABLE STATUS
 
326
 
 
327
flush tables;
 
328
 
 
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';
 
333
--error 1033
 
334
show create table t1;
 
335
drop table if exists t1;
 
336
--error 1,0
 
337
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
 
338
 
 
339
#
 
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.
 
342
#
 
343
 
 
344
--echo
 
345
--echo # Bug#12183: SHOW OPEN TABLES behavior doesn't match grammar.
 
346
--echo
 
347
 
 
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'.
 
352
 
 
353
--disable_warnings
 
354
DROP DATABASE IF EXISTS mysqltest1;
 
355
--enable_warnings
 
356
 
 
357
CREATE DATABASE mysqltest1;
 
358
use mysqltest1;
 
359
 
 
360
--echo
 
361
 
 
362
CREATE TABLE t1(a INT);
 
363
CREATE TABLE t2(a INT);
 
364
 
 
365
--echo
 
366
 
 
367
--disable_ps_protocol
 
368
FLUSH TABLES;
 
369
 
 
370
--echo
 
371
 
 
372
SELECT 1 FROM t1;
 
373
SELECT 1 FROM t2;
 
374
 
 
375
--echo
 
376
 
 
377
SHOW OPEN TABLES FROM mysqltest1;
 
378
 
 
379
--echo
 
380
 
 
381
SHOW OPEN TABLES FROM mysqltest1 LIKE 'z%';
 
382
 
 
383
--echo
 
384
 
 
385
SHOW OPEN TABLES FROM mysqltest1 LIKE 't1%';
 
386
 
 
387
--echo
 
388
 
 
389
SHOW OPEN TABLES FROM mysqltest1 LIKE '%1%';
 
390
 
 
391
--echo
 
392
 
 
393
FLUSH TABLES;
 
394
--enable_ps_protocol
 
395
 
 
396
--echo
 
397
 
 
398
DROP DATABASE mysqltest1;
 
399
use test;
 
400
 
 
401
--echo
 
402
 
301
403
#
302
404
# BUG #12591 (SHOW TABLES FROM dbname produces wrong error message)
303
405
#
304
 
--error ER_BAD_DB_ERROR
 
406
--error 1049
305
407
SHOW TABLES FROM non_existing_database;
306
408
 
307
409
--echo End of 4.1 tests
312
414
#
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;
317
419
 
 
420
 
 
421
#
 
422
# Bug #28808: log_queries_not_using_indexes variable dynamic change is ignored
 
423
#
 
424
flush status;
 
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';
 
436
 
318
437
#
319
438
# Bug #30088: Can't disable myisam-recover by a value of ""
320
439
#
322
441
 
323
442
--echo End of 5.0 tests
324
443
 
 
444
--disable_result_log
 
445
SHOW AUTHORS;
 
446
--enable_result_log
 
447
 
 
448
 
 
449
#
 
450
# Ensure that show plugin code is tested
 
451
#
 
452
 
 
453
--disable_result_log
 
454
show plugins;
 
455
--enable_result_log
 
456
 
325
457
#
326
458
# Bug #19874: SHOW COLUMNS and SHOW KEYS handle identifiers containing
327
459
# \ incorrectly
336
468
drop database `mysqlttest\1`;
337
469
 
338
470
#
339
 
# Bug#25081 show TABLES on table with latin chars in name fails
340
 
#
 
471
# Bug#24392: SHOW ENGINE MUTEX STATUS is a synonym for SHOW INNODB STATUS
 
472
#
 
473
 
 
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;
 
480
 
 
481
--error ER_UNKNOWN_STORAGE_ENGINE
 
482
show engine mutex status;
 
483
 
 
484
show engine csv status;
 
485
show engine csv logs;
 
486
show engine csv mutex;
 
487
#
 
488
# Bug#25081 SHOW FULL TABLES on table with latin chars in name fails
 
489
#
 
490
set names utf8;
341
491
--disable_warnings
342
492
drop table if exists `été`;
343
493
--enable_warnings
344
494
create table `été` (field1 int);
345
 
show tables;
 
495
show full tables;
346
496
drop table `été`;
 
497
set names latin1;
347
498
 
348
499
#
349
500
# Bug#26402 Server crashes with old-style named table
350
501
#
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#????????`;
353
504
 
354
 
#
355
 
# Test error output for SHOW engine_name STATUS
356
 
#
357
 
--error ER_USE_DATA_DICTIONARY
358
 
show innodb status;
359
 
 
360
505
--echo End of 5.1 tests