7
7
-- Here we enable metadata just to check that the collation of the
8
8
-- resultset is non-binary for string type. This should be changed
9
9
-- after Bug#29394 is implemented.
11
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
12
def Table 253 128 7 Y 0 31 8
13
def Op 253 10 5 Y 0 31 8
14
def Msg_type 253 10 6 Y 0 31 8
15
def Msg_text 253 255 27 Y 0 31 8
16
Table Op Msg_type Msg_text
17
test.t1 check status Table is already up to date
19
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
20
def Table 253 128 7 Y 0 31 8
21
def Op 253 10 5 Y 0 31 8
22
def Msg_type 253 10 6 Y 0 31 8
23
def Msg_text 253 255 27 Y 0 31 8
24
Table Op Msg_type Msg_text
25
test.t1 check status Table is already up to date
26
check table t1 changed;
27
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
28
def Table 253 128 7 Y 0 31 8
29
def Op 253 10 5 Y 0 31 8
30
def Msg_type 253 10 6 Y 0 31 8
31
def Msg_text 253 255 2 Y 0 31 8
11
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
12
def Table 8 512 7 Y 0 31 45
13
def Op 8 40 5 Y 0 31 45
14
def Msg_type 8 40 6 Y 0 31 45
15
def Msg_text 8 1020 2 Y 0 31 45
32
16
Table Op Msg_type Msg_text
33
17
test.t1 check status OK
34
18
insert into t1 values (5,5,5);
35
check table t1 changed;
36
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
37
def Table 253 128 7 Y 0 31 8
38
def Op 253 10 5 Y 0 31 8
39
def Msg_type 253 10 6 Y 0 31 8
40
def Msg_text 253 255 2 Y 0 31 8
41
Table Op Msg_type Msg_text
42
test.t1 check status OK
43
check table t1 medium;
44
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
45
def Table 253 128 7 Y 0 31 8
46
def Op 253 10 5 Y 0 31 8
47
def Msg_type 253 10 6 Y 0 31 8
48
def Msg_text 253 255 2 Y 0 31 8
49
Table Op Msg_type Msg_text
50
test.t1 check status OK
51
check table t1 extended;
52
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
53
def Table 253 128 7 Y 0 31 8
54
def Op 253 10 5 Y 0 31 8
55
def Msg_type 253 10 6 Y 0 31 8
56
def Msg_text 253 255 2 Y 0 31 8
20
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
21
def Table 8 512 7 Y 0 31 45
22
def Op 8 40 5 Y 0 31 45
23
def Msg_type 8 40 6 Y 0 31 45
24
def Msg_text 8 1020 2 Y 0 31 45
57
25
Table Op Msg_type Msg_text
58
26
test.t1 check status OK
59
27
show index from t1;
60
28
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
61
def STATISTICS TABLE_NAME Table 253 64 2 N 1 0 8
62
def STATISTICS NON_UNIQUE Non_unique 8 1 1 N 32769 0 63
63
def STATISTICS INDEX_NAME Key_name 253 64 7 N 1 0 8
64
def STATISTICS SEQ_IN_INDEX Seq_in_index 8 2 1 N 32769 0 63
65
def STATISTICS COLUMN_NAME Column_name 253 64 1 N 1 0 8
66
def STATISTICS COLLATION Collation 253 1 1 Y 0 0 8
67
def STATISTICS CARDINALITY Cardinality 8 21 1 Y 32768 0 63
68
def STATISTICS SUB_PART Sub_part 8 3 0 Y 32768 0 63
69
def STATISTICS PACKED Packed 253 10 0 Y 0 0 8
70
def STATISTICS NULLABLE Null 253 3 0 N 1 0 8
71
def STATISTICS INDEX_TYPE Index_type 253 16 5 N 1 0 8
72
def STATISTICS COMMENT Comment 253 16 0 Y 0 0 8
73
def STATISTICS INDEX_COMMENT Index_Comment 253 1024 0 N 1 0 8
74
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
75
t1 0 PRIMARY 1 a A 5 NULL NULL BTREE
76
t1 1 b 1 b A 1 NULL NULL BTREE
77
t1 1 b 2 c A 5 NULL NULL BTREE
29
def data_dictionary show_indexes SHOW_INDEXES Table Table 8 1024 2 N 4097 0 45
30
def data_dictionary show_indexes SHOW_INDEXES Unique Unique 8 20 3 N 4097 0 45
31
def data_dictionary show_indexes SHOW_INDEXES Key_name Key_name 8 1024 7 N 4097 0 45
32
def data_dictionary show_indexes SHOW_INDEXES Seq_in_index Seq_in_index 5 20 1 N 36865 0 63
33
def data_dictionary show_indexes SHOW_INDEXES Column_name Column_name 8 1024 1 N 4097 0 45
34
Table Unique Key_name Seq_in_index Column_name
78
38
insert into t1 values (5,5,5);
79
39
ERROR 23000: Duplicate entry '5' for key 'PRIMARY'
80
40
-- Here we enable metadata just to check that the collation of the
81
41
-- resultset is non-binary for string type. This should be changed
82
42
-- after Bug#29394 is implemented.
84
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
85
def Table 253 128 7 Y 0 31 8
86
def Op 253 10 8 Y 0 31 8
87
def Msg_type 253 10 6 Y 0 31 8
88
def Msg_text 253 255 2 Y 0 31 8
89
Table Op Msg_type Msg_text
90
test.t1 optimize status OK
92
Table Op Msg_type Msg_text
93
test.t1 optimize status Table is already up to date
43
alter table t1 engine="default";
44
alter table t1 engine="default";
95
46
-- Here we enable metadata just to check that the collation of the
96
47
-- resultset is non-binary for string type. This should be changed
97
48
-- after Bug#29394 is implemented.
98
show variables like "wait_timeout%";
99
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
100
def VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8
101
def VARIABLES VARIABLE_VALUE Value 253 16300 5 Y 0 0 8
104
show variables like "WAIT_timeout%";
105
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
106
def VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8
107
def VARIABLES VARIABLE_VALUE Value 253 16300 5 Y 0 0 8
49
show variables like "server_id%";
50
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
51
def data_dictionary session_variables SESSION_VARIABLES VARIABLE_NAME Variable_name 8 1024 9 N 4097 0 45
52
def data_dictionary session_variables SESSION_VARIABLES VARIABLE_VALUE Value 8 4096 1 N 4097 0 45
55
show variables like "SERVER_id%";
56
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
57
def data_dictionary session_variables SESSION_VARIABLES VARIABLE_NAME Variable_name 8 1024 9 N 4097 0 45
58
def data_dictionary session_variables SESSION_VARIABLES VARIABLE_VALUE Value 8 4096 1 N 4097 0 45
110
61
show variables like "this_doesn't_exists%";
111
62
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
112
def VARIABLES VARIABLE_NAME Variable_name 253 64 0 N 1 0 8
113
def VARIABLES VARIABLE_VALUE Value 253 16300 0 Y 0 0 8
63
def data_dictionary session_variables SESSION_VARIABLES VARIABLE_NAME Variable_name 8 1024 0 N 4097 0 45
64
def data_dictionary session_variables SESSION_VARIABLES VARIABLE_VALUE Value 8 4096 0 N 4097 0 45
114
65
Variable_name Value
115
66
show table status from test like "this_doesn't_exists%";
116
67
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
117
def TABLES TABLE_NAME Name 253 64 0 N 1 0 8
118
def TABLES ENGINE Engine 253 64 0 Y 0 0 8
119
def TABLES VERSION Version 8 21 0 Y 32800 0 63
120
def TABLES ROW_FORMAT Row_format 253 10 0 Y 0 0 8
121
def TABLES TABLE_ROWS Rows 8 21 0 Y 32800 0 63
122
def TABLES AVG_ROW_LENGTH Avg_row_length 8 21 0 Y 32800 0 63
123
def TABLES DATA_LENGTH Data_length 8 21 0 Y 32800 0 63
124
def TABLES MAX_DATA_LENGTH Max_data_length 8 21 0 Y 32800 0 63
125
def TABLES INDEX_LENGTH Index_length 8 21 0 Y 32800 0 63
126
def TABLES DATA_FREE Data_free 8 21 0 Y 32800 0 63
127
def TABLES AUTO_INCREMENT Auto_increment 8 21 0 Y 32800 0 63
128
def TABLES CREATE_TIME Create_time 12 19 0 Y 128 0 63
129
def TABLES UPDATE_TIME Update_time 12 19 0 Y 128 0 63
130
def TABLES CHECK_TIME Check_time 12 19 0 Y 128 0 63
131
def TABLES TABLE_COLLATION Collation 253 64 0 Y 0 0 8
132
def TABLES CHECKSUM Checksum 8 21 0 Y 32800 0 63
133
def TABLES CREATE_OPTIONS Create_options 253 255 0 Y 0 0 8
134
def TABLES TABLE_COMMENT Comment 253 2048 0 N 1 0 8
135
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
68
def data_dictionary show_table_status SHOW_TABLE_STATUS Session Session 5 20 0 N 36865 0 63
69
def data_dictionary show_table_status SHOW_TABLE_STATUS Schema Schema 8 1024 0 N 4097 0 45
70
def data_dictionary show_table_status SHOW_TABLE_STATUS Name Name 8 1024 0 N 4097 0 45
71
def data_dictionary show_table_status SHOW_TABLE_STATUS Type Type 8 1024 0 N 4097 0 45
72
def data_dictionary show_table_status SHOW_TABLE_STATUS Engine Engine 8 1024 0 N 4097 0 45
73
def data_dictionary show_table_status SHOW_TABLE_STATUS Version Version 8 1024 0 N 4097 0 45
74
def data_dictionary show_table_status SHOW_TABLE_STATUS Rows Rows 8 1024 0 N 4097 0 45
75
def data_dictionary show_table_status SHOW_TABLE_STATUS Avg_row_length Avg_row_length 8 1024 0 N 4097 0 45
76
def data_dictionary show_table_status SHOW_TABLE_STATUS Table_size Table_size 8 1024 0 N 4097 0 45
77
def data_dictionary show_table_status SHOW_TABLE_STATUS Auto_increment Auto_increment 8 1024 0 N 4097 0 45
78
Session Schema Name Type Engine Version Rows Avg_row_length Table_size Auto_increment
137
80
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
138
def SCHEMATA SCHEMA_NAME Database 253 64 18 N 1 0 8
81
def data_dictionary show_schemas SHOW_SCHEMAS SCHEMA_NAME Database 8 1024 18 N 4097 0 45
143
87
show databases like "test%";
144
88
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
145
def SCHEMATA SCHEMA_NAME Database (test%) 253 64 4 N 1 0 8
89
def data_dictionary show_schemas SHOW_SCHEMAS SCHEMA_NAME Database (test%) 8 1024 4 N 4097 0 45
148
92
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));
204
136
) comment = 'it\'s a table' ;
205
137
show create table t1;
206
138
Table Create Table
207
t1 CREATE TABLE "t1" (
208
"test_set" set('val1','val2','val3') NOT NULL,
209
"name" char(20) COMMENT 'O''Brien as default',
210
"c" int(11) NOT NULL COMMENT 'int column',
211
"c-b" int(11) COMMENT 'name with a minus',
212
"space 2" int(11) COMMENT 'name with a space'
213
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table'
214
set sql_quote_show_create=0;
215
show create table t1;
218
test_set set('val1','val2','val3') NOT NULL,
219
"name" char(20) COMMENT 'O''Brien as default',
220
c int(11) NOT NULL COMMENT 'int column',
221
"c-b" int(11) COMMENT 'name with a minus',
222
"space 2" int(11) COMMENT 'name with a space'
223
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table'
224
set sql_quote_show_create=1;
225
show full columns from t1;
226
Field Type Collation Null Key Default Extra Privileges Comment
227
test_set set('val1','val2','val3') latin1_swedish_ci NO NULL
228
name char(20) latin1_swedish_ci YES NULL O'Brien as default
229
c int(11) NULL NO NULL int column
230
c-b int(11) NULL YES NULL name with a minus
231
space 2 int(11) NULL YES NULL name with a space
139
t1 CREATE TABLE `t1` (
140
`name` VARCHAR(20) COLLATE utf8_general_ci DEFAULT 'O''Brien' COMMENT 'O''Brien as default',
141
`c` INT NOT NULL COMMENT 'int column',
142
`c-b` INT DEFAULT NULL COMMENT 'name with a minus',
143
`space 2` INT DEFAULT NULL COMMENT 'name with a space'
144
) ENGINE=DEFAULT COMMENT='it''s a table' COLLATE = utf8_general_ci
145
show columns from t1;
146
Field Type Null Default Default_is_NULL On_Update
147
name VARCHAR YES O'Brien NO
150
space 2 INTEGER YES YES
233
152
create table t1 (a int not null, unique aa (a));
234
153
show create table t1;
235
154
Table Create Table
236
t1 CREATE TABLE "t1" (
237
"a" int(11) NOT NULL,
238
UNIQUE KEY "aa" ("a")
239
) ENGINE=MyISAM DEFAULT CHARSET=latin1
155
t1 CREATE TABLE `t1` (
157
UNIQUE KEY `aa` (`a`)
158
) ENGINE=DEFAULT COLLATE = utf8_general_ci
241
160
create table t1 (a int not null, primary key (a));
242
161
show create table t1;
243
162
Table Create Table
244
t1 CREATE TABLE "t1" (
245
"a" int(11) NOT NULL,
247
) ENGINE=MyISAM DEFAULT CHARSET=latin1
251
Database Table In_use Name_locked
252
mysql general_log 0 0
253
create table t1(n int);
254
insert into t1 values (1);
256
Database Table In_use Name_locked
258
mysql general_log 0 0
260
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;
261
show create table t1;
263
t1 CREATE TABLE "t1" (
264
"a" int(11) NOT NULL,
267
) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test'
268
alter table t1 MAX_ROWS=200 ROW_FORMAT=dynamic PACK_KEYS=0;
269
show create table t1;
271
t1 CREATE TABLE "t1" (
272
"a" int(11) NOT NULL,
275
) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=200 AVG_ROW_LENGTH=10 PACK_KEYS=0 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC COMMENT='test'
276
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;
277
show create table t1;
279
t1 CREATE TABLE "t1" (
280
"a" int(11) NOT NULL,
283
) ENGINE=MyISAM DEFAULT CHARSET=latin1
163
t1 CREATE TABLE `t1` (
166
) ENGINE=DEFAULT COLLATE = utf8_general_ci
168
create temporary table t1 (a int not null, b VARCHAR(10), INDEX (b) ) COMMENT="test" ENGINE=MYISAM ROW_FORMAT=fixed;
169
show create table t1;
171
t1 CREATE TEMPORARY TABLE `t1` (
173
`b` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
175
) ENGINE=MyISAM ROW_FORMAT='fixed' COMMENT='test' COLLATE = utf8_general_ci
176
alter table t1 ROW_FORMAT=dynamic;
177
show create table t1;
179
t1 CREATE TEMPORARY TABLE `t1` (
181
`b` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
183
) ENGINE=MyISAM ROW_FORMAT='dynamic' COMMENT='test' COLLATE = utf8_general_ci
184
ALTER TABLE t1 COMMENT="", ROW_FORMAT='default';
185
show create table t1;
187
t1 CREATE TEMPORARY TABLE `t1` (
189
`b` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
191
) ENGINE=MyISAM ROW_FORMAT='default' COLLATE = utf8_general_ci
285
193
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));
286
194
show columns from t1;
287
Field Type Null Key Default Extra
288
a decimal(9,2) YES NULL
289
b decimal(9,0) YES NULL
290
e double(9,2) YES NULL
291
f double(5,0) YES NULL
292
h float(3,2) YES NULL
293
i float(3,0) YES NULL
294
show full columns from t1;
295
Field Type Collation Null Key Default Extra Privileges Comment
296
a decimal(9,2) NULL YES NULL
297
b decimal(9,0) NULL YES NULL
298
e double(9,2) NULL YES NULL
299
f double(5,0) NULL YES NULL
300
h float(3,2) NULL YES NULL
301
i float(3,0) NULL YES NULL
195
Field Type Null Default Default_is_NULL On_Update
202
show columns from t1;
203
Field Type Null Default Default_is_NULL On_Update
304
type_bool bool not null default 0,
305
type_tiny tinyint not null auto_increment primary key,
306
type_short smallint(3),
307
type_mediumint mediumint,
211
create temporary table t1 (
308
213
type_bigint bigint,
309
214
type_decimal decimal(5,2),
310
215
type_numeric numeric(5,2),
312
217
type_char char(2),
313
218
type_varchar varchar(10),
314
219
type_timestamp timestamp not null,
315
type_date date not null default '0000-00-00',
316
type_time time not null default '00:00:00',
317
type_datetime datetime not null default '0000-00-00 00:00:00',
221
type_datetime datetime,
319
222
type_enum enum ('red', 'green', 'blue'),
320
223
type_set enum ('red', 'green', 'blue'),
321
type_tinyblob tinyblob,
323
type_medium_blob mediumblob,
324
type_long_blob longblob,
326
) 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;
226
) COMMENT="test" ENGINE=MYISAM ROW_FORMAT=fixed;
327
227
show create table t1;
328
228
Table Create Table
329
t1 CREATE TABLE "t1" (
330
"type_bool" tinyint(1) NOT NULL,
331
"type_tiny" tinyint(4) NOT NULL AUTO_INCREMENT,
332
"type_short" smallint(3),
333
"type_mediumint" mediumint(9),
334
"type_bigint" bigint(20),
335
"type_decimal" decimal(5,2),
336
"type_numeric" decimal(5,2),
337
"empty_char" char(0),
339
"type_varchar" varchar(10),
340
"type_timestamp" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
341
"type_date" date NOT NULL,
342
"type_time" time NOT NULL,
343
"type_datetime" datetime NOT NULL,
345
"type_enum" enum('red','green','blue'),
346
"type_set" enum('red','green','blue'),
347
"type_tinyblob" tinyblob,
349
"type_medium_blob" mediumblob,
350
"type_long_blob" longblob,
351
PRIMARY KEY ("type_tiny"),
352
KEY "type_short" ("type_short")
353
) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test'
229
t1 CREATE TEMPORARY TABLE `t1` (
230
`type_int` INT DEFAULT NULL,
231
`type_bigint` BIGINT DEFAULT NULL,
232
`type_decimal` DECIMAL(5,2) DEFAULT NULL,
233
`type_numeric` DECIMAL(5,2) DEFAULT NULL,
234
`empty_char` VARCHAR(0) COLLATE utf8_general_ci DEFAULT NULL,
235
`type_char` VARCHAR(2) COLLATE utf8_general_ci DEFAULT NULL,
236
`type_varchar` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
237
`type_timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
238
`type_date` DATE DEFAULT NULL,
239
`type_datetime` DATETIME DEFAULT NULL,
240
`type_enum` ENUM('red','green','blue') DEFAULT NULL,
241
`type_set` ENUM('red','green','blue') DEFAULT NULL,
243
KEY `type_int` (`type_int`)
244
) ENGINE=MyISAM ROW_FORMAT='fixed' COMMENT='test' COLLATE = utf8_general_ci
354
245
insert into t1 (type_timestamp) values ("2003-02-07 10:00:01");
355
246
select * from t1;
356
type_bool type_tiny type_short type_mediumint type_bigint type_decimal type_numeric empty_char type_char type_varchar type_timestamp type_date type_time type_datetime type_year type_enum type_set type_tinyblob type_blob type_medium_blob type_long_blob
357
0 1 NULL NULL NULL NULL NULL NULL NULL NULL 2003-02-07 10:00:01 0000-00-00 00:00:00 0000-00-00 00:00:00 NULL NULL NULL NULL NULL NULL NULL
247
type_int type_bigint type_decimal type_numeric empty_char type_char type_varchar type_timestamp type_date type_datetime type_enum type_set type_blob
248
NULL NULL NULL NULL NULL NULL NULL 2003-02-07 10:00:01 NULL NULL NULL NULL NULL
359
250
create table t1 (a int not null);
360
251
create table t2 select max(a) from t1;
361
252
show columns from t2;
362
Field Type Null Key Default Extra
363
max(a) int(11) YES NULL
253
Field Type Null Default Default_is_NULL On_Update
254
max(a) INTEGER YES YES
364
255
drop table t1,t2;
365
256
create table t1 (c decimal, d double, f float, r real);
366
257
show columns from t1;
367
Field Type Null Key Default Extra
368
c decimal(10,0) YES NULL
258
Field Type Null Default Default_is_NULL On_Update
373
264
create table t1 (c decimal(3,3), d double(3,3), f float(3,3));
374
265
show columns from t1;
375
Field Type Null Key Default Extra
376
c decimal(3,3) YES NULL
377
d double(3,3) YES NULL
378
f float(3,3) YES NULL
266
Field Type Null Default Default_is_NULL On_Update
380
271
CREATE TABLE ```ab``cd``` (i INT);
381
272
SHOW CREATE TABLE ```ab``cd```;
382
273
Table Create Table
383
`ab`cd` CREATE TABLE "`ab`cd`" (
385
) ENGINE=MyISAM DEFAULT CHARSET=latin1
274
`ab`cd` CREATE TABLE ```ab``cd``` (
276
) ENGINE=DEFAULT COLLATE = utf8_general_ci
386
277
DROP TABLE ```ab``cd```;
387
278
CREATE TABLE ```ab````cd``` (i INT);
388
279
SHOW CREATE TABLE ```ab````cd```;
389
280
Table Create Table
390
`ab``cd` CREATE TABLE "`ab``cd`" (
392
) ENGINE=MyISAM DEFAULT CHARSET=latin1
281
`ab``cd` CREATE TABLE ```ab````cd``` (
283
) ENGINE=DEFAULT COLLATE = utf8_general_ci
393
284
DROP TABLE ```ab````cd```;
394
285
CREATE TABLE ```a` (i INT);
395
286
SHOW CREATE TABLE ```a`;
396
287
Table Create Table
397
`a CREATE TABLE "`a" (
399
) ENGINE=MyISAM DEFAULT CHARSET=latin1
288
`a CREATE TABLE ```a` (
290
) ENGINE=DEFAULT COLLATE = utf8_general_ci
400
291
DROP TABLE ```a`;
401
292
CREATE TABLE `a.1` (i INT);
402
293
SHOW CREATE TABLE `a.1`;
403
294
Table Create Table
404
a.1 CREATE TABLE "a.1" (
406
) ENGINE=MyISAM DEFAULT CHARSET=latin1
295
a.1 CREATE TABLE `a.1` (
297
) ENGINE=DEFAULT COLLATE = utf8_general_ci
407
298
DROP TABLE `a.1`;
408
299
select @@max_heap_table_size;
409
300
@@max_heap_table_size
412
a int(11) default NULL,
302
CREATE TEMPORARY TABLE t1 (
413
304
KEY a USING BTREE (a)
416
b int(11) default NULL,
306
CREATE TEMPORARY TABLE t2 (
420
a int(11) default NULL,
421
b int(11) default NULL,
310
CREATE TEMPORARY TABLE t3 (
422
313
KEY a USING BTREE (a),
425
316
insert into t1 values (1),(2);
426
317
insert into t2 values (1),(2);
427
318
insert into t3 values (1,1),(2,2);
428
319
show table status;
429
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
430
t1 MEMORY 10 Fixed 2 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
431
t2 MEMORY 10 Fixed 2 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
432
t3 MEMORY 10 Fixed 2 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
320
Session Schema Name Type Engine Version Rows Avg_row_length Table_size Auto_increment
321
# test t1 TEMPORARY MEMORY # # # # #
322
# test t2 TEMPORARY MEMORY # # # # #
323
# test t3 TEMPORARY MEMORY # # # # #
433
324
insert into t1 values (3),(4);
434
325
insert into t2 values (3),(4);
435
326
insert into t3 values (3,3),(4,4);
436
327
show table status;
437
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
438
t1 MEMORY 10 Fixed 4 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
439
t2 MEMORY 10 Fixed 4 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
440
t3 MEMORY 10 Fixed 4 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
328
Session Schema Name Type Engine Version Rows Avg_row_length Table_size Auto_increment
329
# test t1 TEMPORARY MEMORY # # # # #
330
# test t2 TEMPORARY MEMORY # # # # #
331
# test t3 TEMPORARY MEMORY # # # # #
441
332
insert into t1 values (5);
442
333
insert into t2 values (5);
443
334
insert into t3 values (5,5);
444
335
show table status;
445
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
446
t1 MEMORY 10 Fixed 5 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
447
t2 MEMORY 10 Fixed 5 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
448
t3 MEMORY 10 Fixed 5 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
336
Session Schema Name Type Engine Version Rows Avg_row_length Table_size Auto_increment
337
# test t1 TEMPORARY MEMORY # # # # #
338
# test t2 TEMPORARY MEMORY # # # # #
339
# test t3 TEMPORARY MEMORY # # # # #
449
340
delete from t1 where a=3;
450
341
delete from t2 where b=3;
451
342
delete from t3 where a=3;
452
343
show table status;
453
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
454
t1 MEMORY 10 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
455
t2 MEMORY 10 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
456
t3 MEMORY 10 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
344
Session Schema Name Type Engine Version Rows Avg_row_length Table_size Auto_increment
345
# test t1 TEMPORARY MEMORY # # # # #
346
# test t2 TEMPORARY MEMORY # # # # #
347
# test t3 TEMPORARY MEMORY # # # # #
457
348
truncate table t1;
458
349
truncate table t2;
459
350
truncate table t3;
460
351
show table status;
461
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
462
t1 MEMORY 10 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
463
t2 MEMORY 10 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
464
t3 MEMORY 10 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
352
Session Schema Name Type Engine Version Rows Avg_row_length Table_size Auto_increment
353
# test t1 TEMPORARY MEMORY # # # # #
354
# test t2 TEMPORARY MEMORY # # # # #
355
# test t3 TEMPORARY MEMORY # # # # #
465
356
insert into t1 values (5);
466
357
insert into t2 values (5);
467
358
insert into t3 values (5,5);
468
359
show table status;
469
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
470
t1 MEMORY 10 Fixed 1 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
471
t2 MEMORY 10 Fixed 1 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
472
t3 MEMORY 10 Fixed 1 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
360
Session Schema Name Type Engine Version Rows Avg_row_length Table_size Auto_increment
361
# test t1 TEMPORARY MEMORY # # # # #
362
# test t2 TEMPORARY MEMORY # # # # #
363
# test t3 TEMPORARY MEMORY # # # # #
473
364
delete from t1 where a=5;
474
365
delete from t2 where b=5;
475
366
delete from t3 where a=5;
476
367
show table status;
477
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
478
t1 MEMORY 10 Fixed 0 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
479
t2 MEMORY 10 Fixed 0 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
480
t3 MEMORY 10 Fixed 0 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
368
Session Schema Name Type Engine Version Rows Avg_row_length Table_size Auto_increment
369
# test t1 TEMPORARY MEMORY # # # # #
370
# test t2 TEMPORARY MEMORY # # # # #
371
# test t3 TEMPORARY MEMORY # # # # #
481
372
drop table t1, t2, t3;
482
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MEMORY;
483
SHOW CREATE TABLE t1;
485
t1 CREATE TABLE "t1" (
488
) ENGINE=MEMORY DEFAULT CHARSET=latin1
490
CREATE TABLE t1 (i int, KEY USING HASH (i)) ENGINE=MEMORY;
491
SHOW CREATE TABLE t1;
493
t1 CREATE TABLE "t1" (
495
KEY "i" ("i") USING HASH
496
) ENGINE=MEMORY DEFAULT CHARSET=latin1
498
CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MEMORY;
499
SHOW CREATE TABLE t1;
501
t1 CREATE TABLE "t1" (
503
KEY "i" ("i") USING BTREE
504
) ENGINE=MEMORY DEFAULT CHARSET=latin1
506
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
507
SHOW CREATE TABLE t1;
509
t1 CREATE TABLE "t1" (
512
) ENGINE=MyISAM DEFAULT CHARSET=latin1
514
CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
515
SHOW CREATE TABLE t1;
517
t1 CREATE TABLE "t1" (
519
KEY "i" ("i") USING BTREE
520
) ENGINE=MyISAM DEFAULT CHARSET=latin1
522
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
523
SHOW CREATE TABLE t1;
525
t1 CREATE TABLE "t1" (
528
) ENGINE=MyISAM DEFAULT CHARSET=latin1
529
ALTER TABLE t1 ENGINE=MEMORY;
530
SHOW CREATE TABLE t1;
532
t1 CREATE TABLE "t1" (
535
) ENGINE=MEMORY DEFAULT CHARSET=latin1
537
CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
538
SHOW CREATE TABLE t1;
540
t1 CREATE TABLE "t1" (
542
KEY "i" ("i") USING BTREE
543
) ENGINE=MyISAM DEFAULT CHARSET=latin1
544
ALTER TABLE t1 ENGINE=MEMORY;
545
SHOW CREATE TABLE t1;
547
t1 CREATE TABLE "t1" (
549
KEY "i" ("i") USING BTREE
550
) ENGINE=MEMORY DEFAULT CHARSET=latin1
373
CREATE TEMPORARY TABLE t1 (i int, KEY (i)) ENGINE=MEMORY;
374
SHOW CREATE TABLE t1;
376
t1 CREATE TEMPORARY TABLE `t1` (
377
`i` INT DEFAULT NULL,
379
) ENGINE=MEMORY COLLATE = utf8_general_ci
381
CREATE TEMPORARY TABLE t1 (i int, KEY USING HASH (i)) ENGINE=MEMORY;
382
SHOW CREATE TABLE t1;
384
t1 CREATE TEMPORARY TABLE `t1` (
385
`i` INT DEFAULT NULL,
386
KEY `i` (`i`) USING HASH
387
) ENGINE=MEMORY COLLATE = utf8_general_ci
389
CREATE TEMPORARY TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MEMORY;
390
SHOW CREATE TABLE t1;
392
t1 CREATE TEMPORARY TABLE `t1` (
393
`i` INT DEFAULT NULL,
394
KEY `i` (`i`) USING BTREE
395
) ENGINE=MEMORY COLLATE = utf8_general_ci
397
CREATE TEMPORARY TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
398
SHOW CREATE TABLE t1;
400
t1 CREATE TEMPORARY TABLE `t1` (
401
`i` INT DEFAULT NULL,
403
) ENGINE=MyISAM COLLATE = utf8_general_ci
405
CREATE TEMPORARY TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
406
SHOW CREATE TABLE t1;
408
t1 CREATE TEMPORARY TABLE `t1` (
409
`i` INT DEFAULT NULL,
410
KEY `i` (`i`) USING BTREE
411
) ENGINE=MyISAM COLLATE = utf8_general_ci
413
CREATE TEMPORARY TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
414
SHOW CREATE TABLE t1;
416
t1 CREATE TEMPORARY TABLE `t1` (
417
`i` INT DEFAULT NULL,
419
) ENGINE=MyISAM COLLATE = utf8_general_ci
420
ALTER TABLE t1 ENGINE=MEMORY;
421
SHOW CREATE TABLE t1;
423
t1 CREATE TEMPORARY TABLE `t1` (
424
`i` INT DEFAULT NULL,
426
) ENGINE=MEMORY COLLATE = utf8_general_ci
428
CREATE TEMPORARY TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
429
SHOW CREATE TABLE t1;
431
t1 CREATE TEMPORARY TABLE `t1` (
432
`i` INT DEFAULT NULL,
433
KEY `i` (`i`) USING BTREE
434
) ENGINE=MyISAM COLLATE = utf8_general_ci
435
ALTER TABLE t1 ENGINE=MEMORY;
436
SHOW CREATE TABLE t1;
438
t1 CREATE TEMPORARY TABLE `t1` (
439
`i` INT DEFAULT NULL,
440
KEY `i` (`i`) USING BTREE
441
) ENGINE=MEMORY COLLATE = utf8_general_ci
553
444
field1 text NOT NULL,
554
PRIMARY KEY(field1(1000))
445
PRIMARY KEY(field1(180))
556
447
show index from t1;
557
448
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
558
def STATISTICS TABLE_NAME Table 253 64 2 N 1 0 8
559
def STATISTICS NON_UNIQUE Non_unique 8 1 1 N 32769 0 63
560
def STATISTICS INDEX_NAME Key_name 253 64 7 N 1 0 8
561
def STATISTICS SEQ_IN_INDEX Seq_in_index 8 2 1 N 32769 0 63
562
def STATISTICS COLUMN_NAME Column_name 253 64 6 N 1 0 8
563
def STATISTICS COLLATION Collation 253 1 1 Y 0 0 8
564
def STATISTICS CARDINALITY Cardinality 8 21 1 Y 32768 0 63
565
def STATISTICS SUB_PART Sub_part 8 3 4 Y 32768 0 63
566
def STATISTICS PACKED Packed 253 10 0 Y 0 0 8
567
def STATISTICS NULLABLE Null 253 3 0 N 1 0 8
568
def STATISTICS INDEX_TYPE Index_type 253 16 5 N 1 0 8
569
def STATISTICS COMMENT Comment 253 16 0 Y 0 0 8
570
def STATISTICS INDEX_COMMENT Index_Comment 253 1024 0 N 1 0 8
571
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
572
t1 0 PRIMARY 1 field1 A 0 1000 NULL BTREE
449
def data_dictionary show_indexes SHOW_INDEXES Table Table 8 1024 2 N 4097 0 45
450
def data_dictionary show_indexes SHOW_INDEXES Unique Unique 8 20 3 N 4097 0 45
451
def data_dictionary show_indexes SHOW_INDEXES Key_name Key_name 8 1024 7 N 4097 0 45
452
def data_dictionary show_indexes SHOW_INDEXES Seq_in_index Seq_in_index 5 20 1 N 36865 0 63
453
def data_dictionary show_indexes SHOW_INDEXES Column_name Column_name 8 1024 6 N 4097 0 45
454
Table Unique Key_name Seq_in_index Column_name
455
t1 YES PRIMARY 1 field1
574
457
create table t1 (
580
463
SHOW CREATE TABLE t1;
581
464
Table Create Table
582
t1 CREATE TABLE "t1" (
583
"c1" int(11) NOT NULL,
584
"c2" int(11) NOT NULL,
585
PRIMARY KEY ("c1") USING HASH,
586
KEY "c2" ("c2") USING BTREE
587
) ENGINE=MyISAM DEFAULT CHARSET=latin1
465
t1 CREATE TABLE `t1` (
468
PRIMARY KEY (`c1`) USING HASH,
469
KEY `c2` (`c2`) USING BTREE
470
) ENGINE=DEFAULT COLLATE = utf8_general_ci
590
SHOW TABLE STATUS like 't1';
591
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
592
t1 NULL NULL NULL NULL # # # # NULL NULL NULL NULL NULL NULL NULL NULL Incorrect information in file: './test/t1.frm'
593
show create table t1;
594
ERROR HY000: Incorrect information in file: './test/t1.frm'
595
drop table if exists t1;
597
# Bug#12183: SHOW OPEN TABLES behavior doesn't match grammar.
599
DROP DATABASE IF EXISTS mysqltest1;
600
CREATE DATABASE mysqltest1;
603
CREATE TABLE t1(a INT);
604
CREATE TABLE t2(a INT);
613
SHOW OPEN TABLES FROM mysqltest1;
614
Database Table In_use Name_locked
618
SHOW OPEN TABLES FROM mysqltest1 LIKE 'z%';
619
Database Table In_use Name_locked
621
SHOW OPEN TABLES FROM mysqltest1 LIKE 't1%';
622
Database Table In_use Name_locked
625
SHOW OPEN TABLES FROM mysqltest1 LIKE '%1%';
626
Database Table In_use Name_locked
631
DROP DATABASE mysqltest1;
634
472
SHOW TABLES FROM non_existing_database;
635
ERROR 42000: Unknown database 'non_existing_database'
473
ERROR 42000: Unknown schema 'non_existing_database'
637
475
SHOW TABLES FROM no_such_database;
638
ERROR 42000: Unknown database 'no_such_database'
476
ERROR 42000: Unknown schema 'no_such_database'
639
477
SHOW COLUMNS FROM no_such_table;
640
478
ERROR 42S02: Table 'test.no_such_table' doesn't exist
642
show variables like "log_queries_not_using_indexes";
644
log_queries_not_using_indexes ON
645
select 1 from information_schema.tables limit 1;
648
show status like 'slow_queries';
651
set global log_queries_not_using_indexes=OFF;
652
show variables like "log_queries_not_using_indexes";
654
log_queries_not_using_indexes OFF
655
select 1 from information_schema.tables limit 1;
658
show status like 'slow_queries';
661
set global log_queries_not_using_indexes=ON;
662
show variables like "log_queries_not_using_indexes";
664
log_queries_not_using_indexes ON
665
select 1 from information_schema.tables limit 1;
668
show status like 'slow_queries';
671
479
show variables like 'myisam_recover_options';
672
480
Variable_name Value
673
myisam_recover_options OFF
677
482
create database `mysqlttest\1`;
678
483
create table `mysqlttest\1`.`a\b` (a int);
679
484
show tables from `mysqlttest\1`;
680
485
Tables_in_mysqlttest\1
682
487
show fields from `mysqlttest\1`.`a\b`;
683
Field Type Null Key Default Extra
488
Field Type Null Default Default_is_NULL On_Update
685
490
show columns from `a\b` from `mysqlttest\1`;
686
Field Type Null Key Default Extra
491
Field Type Null Default Default_is_NULL On_Update
688
493
show keys from `mysqlttest\1`.`a\b`;
689
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
494
Table Unique Key_name Seq_in_index Column_name
690
495
drop table `mysqlttest\1`.`a\b`;
691
496
drop database `mysqlttest\1`;
692
show engine foobar status;
693
ERROR 42000: Unknown table engine 'foobar'
694
show engine foobar logs;
695
ERROR 42000: Unknown table engine 'foobar'
696
show engine foobar mutex;
697
ERROR 42000: Unknown table engine 'foobar'
698
show engine mutex status;
699
ERROR 42000: Unknown table engine 'mutex'
700
show engine csv status;
702
show engine csv logs;
704
show engine csv mutex;
707
497
drop table if exists `été`;
708
498
create table `été` (field1 int);
710
Tables_in_test Table_type
712
502
drop table `été`;
714
503
show columns from `#mysql50#????????`;
715
504
Got one of the listed errors