1
by brian
clean slate |
1 |
drop table if exists t1,t2;
|
2 |
drop table if exists t1aa,t2aa;
|
|
3 |
drop database if exists mysqltest;
|
|
4 |
drop database if exists mysqltest1;
|
|
5 |
create table t1 (a int not null primary key, b int not null,c int not null, key(b,c));
|
|
6 |
insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4);
|
|
7 |
-- Here we enable metadata just to check that the collation of the
|
|
8 |
-- resultset is non-binary for string type. This should be changed
|
|
9 |
-- after Bug#29394 is implemented.
|
|
10 |
check table t1 fast;
|
|
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
|
|
18 |
check table t1 fast;
|
|
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
|
|
32 |
Table Op Msg_type Msg_text
|
|
33 |
test.t1 check status OK
|
|
34 |
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
|
|
57 |
Table Op Msg_type Msg_text
|
|
58 |
test.t1 check status OK
|
|
59 |
show index from t1;
|
|
60 |
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
|
|
78 |
insert into t1 values (5,5,5);
|
|
79 |
ERROR 23000: Duplicate entry '5' for key 'PRIMARY'
|
|
80 |
-- Here we enable metadata just to check that the collation of the
|
|
81 |
-- resultset is non-binary for string type. This should be changed
|
|
82 |
-- after Bug#29394 is implemented.
|
|
83 |
optimize table t1;
|
|
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
|
|
91 |
optimize table t1;
|
|
92 |
Table Op Msg_type Msg_text
|
|
93 |
test.t1 optimize status Table is already up to date
|
|
94 |
drop table t1;
|
|
95 |
-- Here we enable metadata just to check that the collation of the
|
|
96 |
-- resultset is non-binary for string type. This should be changed
|
|
97 |
-- 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
|
|
102 |
Variable_name Value
|
|
103 |
wait_timeout 28800
|
|
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
|
|
108 |
Variable_name Value
|
|
109 |
wait_timeout 28800
|
|
110 |
show variables like "this_doesn't_exists%";
|
|
111 |
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
|
|
114 |
Variable_name Value
|
|
115 |
show table status from test like "this_doesn't_exists%";
|
|
116 |
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
|
|
136 |
show databases;
|
|
137 |
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
|
|
139 |
Database
|
|
140 |
information_schema
|
|
141 |
mysql
|
|
142 |
test
|
|
143 |
show databases like "test%";
|
|
144 |
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
|
|
146 |
Database (test%)
|
|
147 |
test
|
|
148 |
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));
|
|
149 |
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);
|
|
150 |
-- Here we enable metadata just to check that the collation of the
|
|
151 |
-- resultset is non-binary for string type. This should be changed
|
|
152 |
-- after Bug#29394 is implemented.
|
|
153 |
analyze table t1;
|
|
154 |
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
|
155 |
def Table 253 128 7 Y 0 31 8
|
|
156 |
def Op 253 10 7 Y 0 31 8
|
|
157 |
def Msg_type 253 10 6 Y 0 31 8
|
|
158 |
def Msg_text 253 255 2 Y 0 31 8
|
|
159 |
Table Op Msg_type Msg_text
|
|
160 |
test.t1 analyze status OK
|
|
161 |
show index from t1;
|
|
162 |
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
|
|
163 |
t1 0 PRIMARY 1 f1 A 1 NULL NULL BTREE
|
|
164 |
t1 0 PRIMARY 2 f2 A 3 NULL NULL BTREE
|
|
165 |
t1 0 PRIMARY 3 f3 A 9 NULL NULL BTREE
|
|
166 |
t1 0 PRIMARY 4 f4 A 18 NULL NULL BTREE
|
|
167 |
-- Here we enable metadata just to check that the collation of the
|
|
168 |
-- resultset is non-binary for string type. This should be changed
|
|
169 |
-- after Bug#29394 is implemented.
|
|
170 |
repair table t1;
|
|
171 |
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
|
172 |
def Table 253 128 7 Y 0 31 8
|
|
173 |
def Op 253 10 6 Y 0 31 8
|
|
174 |
def Msg_type 253 10 6 Y 0 31 8
|
|
175 |
def Msg_text 253 255 2 Y 0 31 8
|
|
176 |
Table Op Msg_type Msg_text
|
|
177 |
test.t1 repair status OK
|
|
178 |
show index from t1;
|
|
179 |
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
|
|
180 |
t1 0 PRIMARY 1 f1 A 1 NULL NULL BTREE
|
|
181 |
t1 0 PRIMARY 2 f2 A 3 NULL NULL BTREE
|
|
182 |
t1 0 PRIMARY 3 f3 A 9 NULL NULL BTREE
|
|
183 |
t1 0 PRIMARY 4 f4 A 18 NULL NULL BTREE
|
|
184 |
drop table t1;
|
|
185 |
create temporary table t1 (a int not null);
|
|
186 |
show create table t1;
|
|
187 |
Table Create Table
|
|
188 |
t1 CREATE TEMPORARY TABLE "t1" (
|
|
189 |
"a" int(11) NOT NULL
|
|
190 |
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
|
191 |
alter table t1 rename t2;
|
|
192 |
show create table t2;
|
|
193 |
Table Create Table
|
|
194 |
t2 CREATE TEMPORARY TABLE "t2" (
|
|
195 |
"a" int(11) NOT NULL
|
|
196 |
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
|
197 |
drop table t2;
|
|
198 |
create table t1 (
|
|
199 |
test_set set( 'val1', 'val2', 'val3' ) not null default '',
|
|
200 |
name char(20) default 'O''Brien' comment 'O''Brien as default',
|
|
201 |
c int not null comment 'int column',
|
|
202 |
`c-b` int comment 'name with a minus',
|
|
203 |
`space 2` int comment 'name with a space'
|
|
204 |
) comment = 'it\'s a table' ;
|
|
205 |
show create table t1;
|
|
206 |
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;
|
|
216 |
Table Create Table
|
|
217 |
t1 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
|
|
232 |
drop table t1;
|
|
233 |
create table t1 (a int not null, unique aa (a));
|
|
234 |
show create table t1;
|
|
235 |
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
|
|
240 |
drop table t1;
|
|
241 |
create table t1 (a int not null, primary key (a));
|
|
242 |
show create table t1;
|
|
243 |
Table Create Table
|
|
244 |
t1 CREATE TABLE "t1" (
|
|
245 |
"a" int(11) NOT NULL,
|
|
246 |
PRIMARY KEY ("a")
|
|
247 |
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
|
248 |
drop table t1;
|
|
249 |
flush tables;
|
|
250 |
show open tables;
|
|
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);
|
|
255 |
show open tables;
|
|
256 |
Database Table In_use Name_locked
|
|
257 |
test t1 0 0
|
|
258 |
mysql general_log 0 0
|
|
259 |
drop table t1;
|
|
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;
|
|
262 |
Table Create Table
|
|
263 |
t1 CREATE TABLE "t1" (
|
|
264 |
"a" int(11) NOT NULL,
|
|
265 |
"b" varchar(10),
|
|
266 |
KEY "b" ("b")
|
|
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;
|
|
270 |
Table Create Table
|
|
271 |
t1 CREATE TABLE "t1" (
|
|
272 |
"a" int(11) NOT NULL,
|
|
273 |
"b" varchar(10),
|
|
274 |
KEY "b" ("b")
|
|
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;
|
|
278 |
Table Create Table
|
|
279 |
t1 CREATE TABLE "t1" (
|
|
280 |
"a" int(11) NOT NULL,
|
|
281 |
"b" varchar(10),
|
|
282 |
KEY "b" ("b")
|
|
283 |
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
|
284 |
drop table t1;
|
|
285 |
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 |
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
|
|
302 |
drop table t1;
|
|
303 |
create table t1 (
|
|
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,
|
|
308 |
type_bigint bigint,
|
|
309 |
type_decimal decimal(5,2),
|
|
310 |
type_numeric numeric(5,2),
|
|
311 |
empty_char char(0),
|
|
312 |
type_char char(2),
|
|
313 |
type_varchar varchar(10),
|
|
314 |
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',
|
|
318 |
type_year year,
|
|
319 |
type_enum enum ('red', 'green', 'blue'),
|
|
320 |
type_set enum ('red', 'green', 'blue'),
|
|
321 |
type_tinyblob tinyblob,
|
|
322 |
type_blob blob,
|
|
323 |
type_medium_blob mediumblob,
|
|
324 |
type_long_blob longblob,
|
|
325 |
index(type_short)
|
|
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;
|
|
327 |
show create table t1;
|
|
328 |
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),
|
|
338 |
"type_char" char(2),
|
|
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,
|
|
344 |
"type_year" year(4),
|
|
345 |
"type_enum" enum('red','green','blue'),
|
|
346 |
"type_set" enum('red','green','blue'),
|
|
347 |
"type_tinyblob" tinyblob,
|
|
348 |
"type_blob" blob,
|
|
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'
|
|
354 |
insert into t1 (type_timestamp) values ("2003-02-07 10:00:01");
|
|
355 |
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
|
|
358 |
drop table t1;
|
|
359 |
create table t1 (a int not null);
|
|
360 |
create table t2 select max(a) from t1;
|
|
361 |
show columns from t2;
|
|
362 |
Field Type Null Key Default Extra
|
|
363 |
max(a) int(11) YES NULL
|
|
364 |
drop table t1,t2;
|
|
365 |
create table t1 (c decimal, d double, f float, r real);
|
|
366 |
show columns from t1;
|
|
367 |
Field Type Null Key Default Extra
|
|
368 |
c decimal(10,0) YES NULL
|
|
369 |
d double YES NULL
|
|
370 |
f float YES NULL
|
|
371 |
r double YES NULL
|
|
372 |
drop table t1;
|
|
373 |
create table t1 (c decimal(3,3), d double(3,3), f float(3,3));
|
|
374 |
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
|
|
379 |
drop table t1;
|
|
380 |
CREATE TABLE ```ab``cd``` (i INT);
|
|
381 |
SHOW CREATE TABLE ```ab``cd```;
|
|
382 |
Table Create Table
|
|
383 |
`ab`cd` CREATE TABLE "`ab`cd`" (
|
|
384 |
"i" int(11)
|
|
385 |
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
|
386 |
DROP TABLE ```ab``cd```;
|
|
387 |
CREATE TABLE ```ab````cd``` (i INT);
|
|
388 |
SHOW CREATE TABLE ```ab````cd```;
|
|
389 |
Table Create Table
|
|
390 |
`ab``cd` CREATE TABLE "`ab``cd`" (
|
|
391 |
"i" int(11)
|
|
392 |
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
|
393 |
DROP TABLE ```ab````cd```;
|
|
394 |
CREATE TABLE ```a` (i INT);
|
|
395 |
SHOW CREATE TABLE ```a`;
|
|
396 |
Table Create Table
|
|
397 |
`a CREATE TABLE "`a" (
|
|
398 |
"i" int(11)
|
|
399 |
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
|
400 |
DROP TABLE ```a`;
|
|
401 |
CREATE TABLE `a.1` (i INT);
|
|
402 |
SHOW CREATE TABLE `a.1`;
|
|
403 |
Table Create Table
|
|
404 |
a.1 CREATE TABLE "a.1" (
|
|
405 |
"i" int(11)
|
|
406 |
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
|
407 |
DROP TABLE `a.1`;
|
|
408 |
select @@max_heap_table_size;
|
|
409 |
@@max_heap_table_size
|
|
410 |
1048576
|
|
411 |
CREATE TABLE t1 (
|
|
412 |
a int(11) default NULL,
|
|
413 |
KEY a USING BTREE (a)
|
|
414 |
) ENGINE=HEAP;
|
|
415 |
CREATE TABLE t2 (
|
|
416 |
b int(11) default NULL,
|
|
417 |
index(b)
|
|
418 |
) ENGINE=HEAP;
|
|
419 |
CREATE TABLE t3 (
|
|
420 |
a int(11) default NULL,
|
|
421 |
b int(11) default NULL,
|
|
422 |
KEY a USING BTREE (a),
|
|
423 |
index(b)
|
|
424 |
) ENGINE=HEAP;
|
|
425 |
insert into t1 values (1),(2);
|
|
426 |
insert into t2 values (1),(2);
|
|
427 |
insert into t3 values (1,1),(2,2);
|
|
428 |
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
|
|
433 |
insert into t1 values (3),(4);
|
|
434 |
insert into t2 values (3),(4);
|
|
435 |
insert into t3 values (3,3),(4,4);
|
|
436 |
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
|
|
441 |
insert into t1 values (5);
|
|
442 |
insert into t2 values (5);
|
|
443 |
insert into t3 values (5,5);
|
|
444 |
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
|
|
449 |
delete from t1 where a=3;
|
|
450 |
delete from t2 where b=3;
|
|
451 |
delete from t3 where a=3;
|
|
452 |
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
|
|
457 |
truncate table t1;
|
|
458 |
truncate table t2;
|
|
459 |
truncate table t3;
|
|
460 |
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
|
|
465 |
insert into t1 values (5);
|
|
466 |
insert into t2 values (5);
|
|
467 |
insert into t3 values (5,5);
|
|
468 |
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
|
|
473 |
delete from t1 where a=5;
|
|
474 |
delete from t2 where b=5;
|
|
475 |
delete from t3 where a=5;
|
|
476 |
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
|
|
481 |
drop table t1, t2, t3;
|
|
482 |
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MEMORY;
|
|
483 |
SHOW CREATE TABLE t1;
|
|
484 |
Table Create Table
|
|
485 |
t1 CREATE TABLE "t1" (
|
|
486 |
"i" int(11),
|
|
487 |
KEY "i" ("i")
|
|
488 |
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
|
489 |
DROP TABLE t1;
|
|
490 |
CREATE TABLE t1 (i int, KEY USING HASH (i)) ENGINE=MEMORY;
|
|
491 |
SHOW CREATE TABLE t1;
|
|
492 |
Table Create Table
|
|
493 |
t1 CREATE TABLE "t1" (
|
|
494 |
"i" int(11),
|
|
495 |
KEY "i" ("i") USING HASH
|
|
496 |
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
|
497 |
DROP TABLE t1;
|
|
498 |
CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MEMORY;
|
|
499 |
SHOW CREATE TABLE t1;
|
|
500 |
Table Create Table
|
|
501 |
t1 CREATE TABLE "t1" (
|
|
502 |
"i" int(11),
|
|
503 |
KEY "i" ("i") USING BTREE
|
|
504 |
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
|
505 |
DROP TABLE t1;
|
|
506 |
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
|
|
507 |
SHOW CREATE TABLE t1;
|
|
508 |
Table Create Table
|
|
509 |
t1 CREATE TABLE "t1" (
|
|
510 |
"i" int(11),
|
|
511 |
KEY "i" ("i")
|
|
512 |
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
|
513 |
DROP TABLE t1;
|
|
514 |
CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
|
|
515 |
SHOW CREATE TABLE t1;
|
|
516 |
Table Create Table
|
|
517 |
t1 CREATE TABLE "t1" (
|
|
518 |
"i" int(11),
|
|
519 |
KEY "i" ("i") USING BTREE
|
|
520 |
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
|
521 |
DROP TABLE t1;
|
|
522 |
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
|
|
523 |
SHOW CREATE TABLE t1;
|
|
524 |
Table Create Table
|
|
525 |
t1 CREATE TABLE "t1" (
|
|
526 |
"i" int(11),
|
|
527 |
KEY "i" ("i")
|
|
528 |
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
|
529 |
ALTER TABLE t1 ENGINE=MEMORY;
|
|
530 |
SHOW CREATE TABLE t1;
|
|
531 |
Table Create Table
|
|
532 |
t1 CREATE TABLE "t1" (
|
|
533 |
"i" int(11),
|
|
534 |
KEY "i" ("i")
|
|
535 |
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
|
536 |
DROP TABLE t1;
|
|
537 |
CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
|
|
538 |
SHOW CREATE TABLE t1;
|
|
539 |
Table Create Table
|
|
540 |
t1 CREATE TABLE "t1" (
|
|
541 |
"i" int(11),
|
|
542 |
KEY "i" ("i") USING BTREE
|
|
543 |
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
|
544 |
ALTER TABLE t1 ENGINE=MEMORY;
|
|
545 |
SHOW CREATE TABLE t1;
|
|
546 |
Table Create Table
|
|
547 |
t1 CREATE TABLE "t1" (
|
|
548 |
"i" int(11),
|
|
549 |
KEY "i" ("i") USING BTREE
|
|
550 |
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
|
551 |
DROP TABLE t1;
|
|
552 |
CREATE TABLE t1(
|
|
553 |
field1 text NOT NULL,
|
|
554 |
PRIMARY KEY(field1(1000))
|
|
555 |
);
|
|
556 |
show index from t1;
|
|
557 |
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
|
|
573 |
drop table t1;
|
|
574 |
create table t1 (
|
|
575 |
c1 int NOT NULL,
|
|
576 |
c2 int NOT NULL,
|
|
577 |
PRIMARY KEY USING HASH (c1),
|
|
578 |
INDEX USING BTREE(c2)
|
|
579 |
);
|
|
580 |
SHOW CREATE TABLE t1;
|
|
581 |
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
|
|
588 |
DROP TABLE t1;
|
|
589 |
flush tables;
|
|
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;
|
|
596 |
||
597 |
# Bug#12183: SHOW OPEN TABLES behavior doesn't match grammar. |
|
598 |
||
599 |
DROP DATABASE IF EXISTS mysqltest1; |
|
600 |
CREATE DATABASE mysqltest1; |
|
601 |
use mysqltest1; |
|
602 |
||
603 |
CREATE TABLE t1(a INT); |
|
604 |
CREATE TABLE t2(a INT); |
|
605 |
||
606 |
FLUSH TABLES; |
|
607 |
||
608 |
SELECT 1 FROM t1; |
|
609 |
1 |
|
610 |
SELECT 1 FROM t2; |
|
611 |
1 |
|
612 |
||
613 |
SHOW OPEN TABLES FROM mysqltest1; |
|
614 |
Database Table In_use Name_locked |
|
615 |
mysqltest1 t1 0 0 |
|
616 |
mysqltest1 t2 0 0 |
|
617 |
||
618 |
SHOW OPEN TABLES FROM mysqltest1 LIKE 'z%'; |
|
619 |
Database Table In_use Name_locked |
|
620 |
||
621 |
SHOW OPEN TABLES FROM mysqltest1 LIKE 't1%'; |
|
622 |
Database Table In_use Name_locked |
|
623 |
mysqltest1 t1 0 0 |
|
624 |
||
625 |
SHOW OPEN TABLES FROM mysqltest1 LIKE '%1%'; |
|
626 |
Database Table In_use Name_locked |
|
627 |
mysqltest1 t1 0 0 |
|
628 |
||
629 |
FLUSH TABLES; |
|
630 |
||
631 |
DROP DATABASE mysqltest1; |
|
632 |
use test; |
|
633 |
||
634 |
SHOW TABLES FROM non_existing_database; |
|
635 |
ERROR 42000: Unknown database 'non_existing_database' |
|
636 |
End of 4.1 tests |
|
637 |
SHOW TABLES FROM no_such_database; |
|
638 |
ERROR 42000: Unknown database 'no_such_database' |
|
639 |
SHOW COLUMNS FROM no_such_table; |
|
640 |
ERROR 42S02: Table 'test.no_such_table' doesn't exist |
|
641 |
flush status; |
|
642 |
show variables like "log_queries_not_using_indexes"; |
|
643 |
Variable_name Value |
|
644 |
log_queries_not_using_indexes ON |
|
645 |
select 1 from information_schema.tables limit 1; |
|
646 |
1 |
|
647 |
1 |
|
648 |
show status like 'slow_queries'; |
|
649 |
Variable_name Value |
|
650 |
Slow_queries 1 |
|
651 |
set global log_queries_not_using_indexes=OFF; |
|
652 |
show variables like "log_queries_not_using_indexes"; |
|
653 |
Variable_name Value |
|
654 |
log_queries_not_using_indexes OFF |
|
655 |
select 1 from information_schema.tables limit 1; |
|
656 |
1 |
|
657 |
1 |
|
658 |
show status like 'slow_queries'; |
|
659 |
Variable_name Value |
|
660 |
Slow_queries 1 |
|
661 |
set global log_queries_not_using_indexes=ON; |
|
662 |
show variables like "log_queries_not_using_indexes"; |
|
663 |
Variable_name Value |
|
664 |
log_queries_not_using_indexes ON |
|
665 |
select 1 from information_schema.tables limit 1; |
|
666 |
1 |
|
667 |
1 |
|
668 |
show status like 'slow_queries'; |
|
669 |
Variable_name Value |
|
670 |
Slow_queries 2 |
|
671 |
show variables like 'myisam_recover_options'; |
|
672 |
Variable_name Value |
|
673 |
myisam_recover_options OFF |
|
674 |
End of 5.0 tests |
|
675 |
SHOW AUTHORS; |
|
676 |
show plugins; |
|
677 |
create database `mysqlttest\1`; |
|
678 |
create table `mysqlttest\1`.`a\b` (a int); |
|
679 |
show tables from `mysqlttest\1`; |
|
680 |
Tables_in_mysqlttest\1 |
|
681 |
a\b |
|
682 |
show fields from `mysqlttest\1`.`a\b`; |
|
683 |
Field Type Null Key Default Extra |
|
684 |
a int(11) YES NULL |
|
685 |
show columns from `a\b` from `mysqlttest\1`; |
|
686 |
Field Type Null Key Default Extra |
|
687 |
a int(11) YES NULL |
|
688 |
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 |
|
690 |
drop table `mysqlttest\1`.`a\b`; |
|
691 |
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; |
|
701 |
Type Name Status |
|
702 |
show engine csv logs; |
|
703 |
Type Name Status |
|
704 |
show engine csv mutex; |
|
705 |
Type Name Status |
|
706 |
set names utf8; |
|
707 |
drop table if exists `été`; |
|
708 |
create table `été` (field1 int); |
|
709 |
show full tables; |
|
710 |
Tables_in_test Table_type |
|
711 |
été BASE TABLE |
|
712 |
drop table `été`; |
|
713 |
set names latin1; |
|
714 |
show columns from `#mysql50#????????`; |
|
715 |
Got one of the listed errors |
|
716 |
End of 5.1 tests |