88
101
`c-b` int comment 'name with a minus',
89
102
`space 2` int comment 'name with a space'
90
103
) comment = 'it\'s a table' ;
91
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
92
104
show create table t1;
105
show full columns from t1;
96
108
create table t1 (a int not null, unique aa (a));
97
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
98
109
show create table t1;
100
111
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';
112
show create table t1;
117
create table t1(n int);
118
insert into t1 values (1);
122
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;
123
show create table t1;
124
alter table t1 MAX_ROWS=200 ROW_FORMAT=dynamic PACK_KEYS=0;
125
show create table t1;
126
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
127
show create table t1;
113
130
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
131
show columns from t1;
115
show columns from t1;
132
show full columns from t1;
119
136
# Do a create table that tries to cover all types and options
121
create temporary table t1 (
123
140
type_bigint bigint,
124
141
type_decimal decimal(5,2),
166
183
CREATE TABLE ```ab``cd``` (i INT);
167
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
168
184
SHOW CREATE TABLE ```ab``cd```;
169
185
DROP TABLE ```ab``cd```;
171
187
CREATE TABLE ```ab````cd``` (i INT);
172
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
173
188
SHOW CREATE TABLE ```ab````cd```;
174
189
DROP TABLE ```ab````cd```;
176
191
CREATE TABLE ```a` (i INT);
177
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
178
192
SHOW CREATE TABLE ```a`;
179
193
DROP TABLE ```a`;
181
195
CREATE TABLE `a.1` (i INT);
182
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
183
196
SHOW CREATE TABLE `a.1`;
184
197
DROP TABLE `a.1`;
188
# Test for bug #2719 "MEMORY tables status shows wrong or missing data."
201
# Test for bug #2719 "Heap tables status shows wrong or missing data."
191
204
select @@max_heap_table_size;
193
CREATE TEMPORARY TABLE t1 (
194
207
a int default NULL,
195
208
KEY a USING BTREE (a)
198
CREATE TEMPORARY TABLE t2 (
199
212
b int default NULL,
203
CREATE TEMPORARY TABLE t3 (
204
217
a int default NULL,
205
218
b int default NULL,
206
219
KEY a USING BTREE (a),
210
223
insert into t1 values (1),(2);
211
224
insert into t2 values (1),(2);
212
225
insert into t3 values (1,1),(2,2);
213
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
226
--replace_column 6 # 7 # 8 # 9 #
214
227
show table status;
215
228
insert into t1 values (3),(4);
216
229
insert into t2 values (3),(4);
217
230
insert into t3 values (3,3),(4,4);
218
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
231
--replace_column 6 # 7 # 8 # 9 #
219
232
show table status;
220
233
insert into t1 values (5);
221
234
insert into t2 values (5);
222
235
insert into t3 values (5,5);
223
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
236
--replace_column 6 # 7 # 8 # 9 #
224
237
show table status;
225
238
delete from t1 where a=3;
226
239
delete from t2 where b=3;
227
240
delete from t3 where a=3;
228
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
241
--replace_column 6 # 7 # 8 # 9 # 10 #
229
242
show table status;
230
243
truncate table t1;
231
244
truncate table t2;
232
245
truncate table t3;
233
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
246
--replace_column 6 # 7 # 8 # 9 #
234
247
show table status;
235
248
insert into t1 values (5);
236
249
insert into t2 values (5);
237
250
insert into t3 values (5,5);
238
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
251
--replace_column 6 # 7 # 8 # 9 #
239
252
show table status;
240
253
delete from t1 where a=5;
241
254
delete from t2 where b=5;
242
255
delete from t3 where a=5;
243
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
256
--replace_column 6 # 7 # 8 # 9 # 10 #
244
257
show table status;
246
259
drop table t1, t2, t3;
248
261
# Test that USING <keytype> is always shown in SHOW CREATE TABLE when it was
249
262
# 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;
263
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MEMORY;
264
SHOW CREATE TABLE t1;
266
CREATE TABLE t1 (i int, KEY USING HASH (i)) ENGINE=MEMORY;
267
SHOW CREATE TABLE t1;
269
CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MEMORY;
270
SHOW CREATE TABLE t1;
272
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
273
SHOW CREATE TABLE t1;
275
CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
263
276
SHOW CREATE TABLE t1;
265
278
# Test that when an index is created with the default key algorithm and
266
279
# altered to another storage engine, it gets the default key algorithm
267
280
# for that storage engine, but when it is specified, the specified type is
269
CREATE TEMPORARY TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
282
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
270
283
SHOW CREATE TABLE t1;
271
284
ALTER TABLE t1 ENGINE=MEMORY;
272
285
SHOW CREATE TABLE t1;
274
CREATE TEMPORARY TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
287
CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
275
288
SHOW CREATE TABLE t1;
276
289
ALTER TABLE t1 ENGINE=MEMORY;
277
290
SHOW CREATE TABLE t1;
294
307
PRIMARY KEY USING HASH (c1),
295
308
INDEX USING BTREE(c2)
297
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
298
310
SHOW CREATE TABLE t1;
314
# BUG 12183 - SHOW OPEN TABLES behavior doesn't match grammar
315
# First we close all open tables with FLUSH tables and then we open some.
319
--echo # Bug#12183: SHOW OPEN TABLES behavior doesn't match grammar.
322
# NOTE: SHOW OPEN TABLES does not sort result list by database or table names.
323
# Tables are listed in the order they were opened. We can not use the system
324
# database (mysql) for the test here, because we have no control over the order
325
# of opening tables in it. Consequently, we can not use 'SHOW OPEN TABLES'.
328
DROP DATABASE IF EXISTS mysqltest1;
331
CREATE DATABASE mysqltest1;
336
CREATE TABLE t1(a INT);
337
CREATE TABLE t2(a INT);
341
--disable_ps_protocol
351
SHOW OPEN TABLES FROM mysqltest1;
355
SHOW OPEN TABLES FROM mysqltest1 LIKE 'z%';
359
SHOW OPEN TABLES FROM mysqltest1 LIKE 't1%';
363
SHOW OPEN TABLES FROM mysqltest1 LIKE '%1%';
372
DROP DATABASE mysqltest1;
302
378
# BUG #12591 (SHOW TABLES FROM dbname produces wrong error message)
304
--error ER_BAD_DB_ERROR
305
381
SHOW TABLES FROM non_existing_database;
307
383
--echo End of 4.1 tests