Commit 7c10a898 authored by Alexander Nozdrin's avatar Alexander Nozdrin

Patch for WL#3736: Extended Table, Column and Index Comments.

The task is to 
  (a) add a comment on indexes and 
  (b) increase the maximum length of column, table and the new index comments.

The patch committed on behalf of Yoshinori Matsunobu (Yoshinori.Matsunobu@Sun.COM).
parent 7ba05466
...@@ -273,6 +273,7 @@ enum ha_base_keytype { ...@@ -273,6 +273,7 @@ enum ha_base_keytype {
#define HA_SPACE_PACK_USED 4 /* Test for if SPACE_PACK used */ #define HA_SPACE_PACK_USED 4 /* Test for if SPACE_PACK used */
#define HA_VAR_LENGTH_KEY 8 #define HA_VAR_LENGTH_KEY 8
#define HA_NULL_PART_KEY 64 #define HA_NULL_PART_KEY 64
#define HA_USES_COMMENT 4096
#define HA_USES_PARSER 16384 /* Fulltext index uses [pre]parser */ #define HA_USES_PARSER 16384 /* Fulltext index uses [pre]parser */
#define HA_USES_BLOCK_SIZE ((uint) 32768) #define HA_USES_BLOCK_SIZE ((uint) 32768)
#define HA_SORT_ALLOWS_SAME 512 /* Intern bit when sorting records */ #define HA_SORT_ALLOWS_SAME 512 /* Intern bit when sorting records */
......
...@@ -32,6 +32,14 @@ ...@@ -32,6 +32,14 @@
#define SERVER_VERSION_LENGTH 60 #define SERVER_VERSION_LENGTH 60
#define SQLSTATE_LENGTH 5 #define SQLSTATE_LENGTH 5
/*
Maximum length of comments
*/
#define TABLE_COMMENT_INLINE_MAXLEN 180 /* pre 6.0: 60 characters */
#define TABLE_COMMENT_MAXLEN 2048
#define COLUMN_COMMENT_MAXLEN 1024
#define INDEX_COMMENT_MAXLEN 1024
/* /*
USER_HOST_BUFF_SIZE -- length of string buffer, that is enough to contain USER_HOST_BUFF_SIZE -- length of string buffer, that is enough to contain
username and hostname parts of the user identifier with trailing zero in username and hostname parts of the user identifier with trailing zero in
......
This diff is collapsed.
...@@ -53,7 +53,7 @@ analyze table t1; ...@@ -53,7 +53,7 @@ analyze table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze status OK test.t1 analyze status OK
show index from t1; show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A 5 NULL NULL YES BTREE t1 1 a 1 a A 5 NULL NULL YES BTREE
drop table t1; drop table t1;
End of 4.1 tests End of 4.1 tests
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
...@@ -2090,7 +2090,7 @@ fld6 char(4) latin1_swedish_ci NO # ...@@ -2090,7 +2090,7 @@ fld6 char(4) latin1_swedish_ci NO #
show full columns from t2 from test like 's%'; show full columns from t2 from test like 's%';
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
show keys from t2; show keys from t2;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE
t2 0 fld1 1 fld1 A 1199 NULL NULL BTREE t2 0 fld1 1 fld1 A 1199 NULL NULL BTREE
t2 1 fld3 1 fld3 A NULL NULL NULL BTREE t2 1 fld3 1 fld3 A NULL NULL NULL BTREE
......
...@@ -1553,12 +1553,12 @@ CREATE TABLE t1(c1 VARCHAR(33), KEY (c1) USING BTREE); ...@@ -1553,12 +1553,12 @@ CREATE TABLE t1(c1 VARCHAR(33), KEY (c1) USING BTREE);
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1) USING HASH) ENGINE=MEMORY; CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1) USING HASH) ENGINE=MEMORY;
SHOW INDEX FROM t1; SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 c1 1 c1 NULL 0 NULL NULL YES HASH t1 1 c1 1 c1 NULL 0 NULL NULL YES HASH
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1(c1 VARCHAR(33), KEY USING HASH (c1) USING BTREE) ENGINE=MEMORY; CREATE TABLE t1(c1 VARCHAR(33), KEY USING HASH (c1) USING BTREE) ENGINE=MEMORY;
SHOW INDEX FROM t1; SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 c1 1 c1 A NULL NULL NULL YES BTREE t1 1 c1 1 c1 A NULL NULL NULL YES BTREE
DROP TABLE t1; DROP TABLE t1;
create user mysqltest_1@'test@test'; create user mysqltest_1@'test@test';
......
...@@ -32,7 +32,7 @@ t1 CREATE TABLE `t1` ( ...@@ -32,7 +32,7 @@ t1 CREATE TABLE `t1` (
KEY `key_a` (`a`(3)) KEY `key_a` (`a`(3))
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW KEYS FROM t1; SHOW KEYS FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 key_a 1 a A NULL 3 NULL YES BTREE t1 1 key_a 1 a A NULL 3 NULL YES BTREE
ALTER TABLE t1 CHANGE a a CHAR(4); ALTER TABLE t1 CHANGE a a CHAR(4);
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
...@@ -42,7 +42,7 @@ t1 CREATE TABLE `t1` ( ...@@ -42,7 +42,7 @@ t1 CREATE TABLE `t1` (
KEY `key_a` (`a`(3)) KEY `key_a` (`a`(3))
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW KEYS FROM t1; SHOW KEYS FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 key_a 1 a A NULL 3 NULL YES BTREE t1 1 key_a 1 a A NULL 3 NULL YES BTREE
ALTER TABLE t1 CHANGE a a CHAR(4) CHARACTER SET utf8; ALTER TABLE t1 CHANGE a a CHAR(4) CHARACTER SET utf8;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
...@@ -52,6 +52,6 @@ t1 CREATE TABLE `t1` ( ...@@ -52,6 +52,6 @@ t1 CREATE TABLE `t1` (
KEY `key_a` (`a`(3)) KEY `key_a` (`a`(3))
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW KEYS FROM t1; SHOW KEYS FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 key_a 1 a A NULL 3 NULL YES BTREE t1 1 key_a 1 a A NULL 3 NULL YES BTREE
DROP TABLE t1; DROP TABLE t1;
...@@ -6,7 +6,7 @@ INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'), ...@@ -6,7 +6,7 @@ INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
('Function MATCH ... AGAINST()','is used to do a search'), ('Function MATCH ... AGAINST()','is used to do a search'),
('Full-text search in MySQL', 'implements vector space model'); ('Full-text search in MySQL', 'implements vector space model');
SHOW INDEX FROM t1; SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a NULL NULL NULL NULL YES FULLTEXT t1 1 a 1 a NULL NULL NULL NULL YES FULLTEXT
t1 1 a 2 b NULL NULL NULL NULL YES FULLTEXT t1 1 a 2 b NULL NULL NULL NULL YES FULLTEXT
select * from t1 where MATCH(a,b) AGAINST ("collections"); select * from t1 where MATCH(a,b) AGAINST ("collections");
...@@ -242,7 +242,7 @@ match(ttxt.inhalt) against ('foobar'); ...@@ -242,7 +242,7 @@ match(ttxt.inhalt) against ('foobar');
id id
3 3
show keys from t2; show keys from t2;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t2 1 tig 1 ticket A NULL NULL NULL YES BTREE t2 1 tig 1 ticket A NULL NULL NULL YES BTREE
t2 1 tix 1 inhalt NULL NULL NULL NULL YES FULLTEXT t2 1 tix 1 inhalt NULL NULL NULL NULL YES FULLTEXT
show create table t2; show create table t2;
......
...@@ -87,14 +87,14 @@ use mysqltest_db1; ...@@ -87,14 +87,14 @@ use mysqltest_db1;
** Connect as restricted user mysqltest_u1. ** Connect as restricted user mysqltest_u1.
** SELECT FROM INFORMATION_SCHEMA.STATISTICS will succeed because any privileges will do (authentication is enough). ** SELECT FROM INFORMATION_SCHEMA.STATISTICS will succeed because any privileges will do (authentication is enough).
SELECT * FROM INFORMATION_SCHEMA.STATISTICS WHERE table_name='t5'; SELECT * FROM INFORMATION_SCHEMA.STATISTICS WHERE table_name='t5';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
def mysqltest_db1 t5 1 mysqltest_db1 i 1 s1 A NULL NULL NULL YES BTREE def mysqltest_db1 t5 1 mysqltest_db1 i 1 s1 A NULL NULL NULL YES BTREE
** SHOW INDEX FROM t5 will fail because we don't have any privileges on any column combination. ** SHOW INDEX FROM t5 will fail because we don't have any privileges on any column combination.
SHOW INDEX FROM t5; SHOW INDEX FROM t5;
ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't5' ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't5'
** SHOW INDEX FROM t6 will succeed because there exist a privilege on a column combination on t6. ** SHOW INDEX FROM t6 will succeed because there exist a privilege on a column combination on t6.
SHOW INDEX FROM t6; SHOW INDEX FROM t6;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t6 1 i 1 s1 A NULL NULL NULL YES BTREE t6 1 i 1 s1 A NULL NULL NULL YES BTREE
** CHECK TABLE requires any privilege on any column combination and should succeed for t6: ** CHECK TABLE requires any privilege on any column combination and should succeed for t6:
CHECK TABLE t6; CHECK TABLE t6;
......
...@@ -3,7 +3,7 @@ create table t1 (a int not null,b int not null, primary key (a)) engine=heap com ...@@ -3,7 +3,7 @@ create table t1 (a int not null,b int not null, primary key (a)) engine=heap com
insert into t1 values(1,1),(2,2),(3,3),(4,4); insert into t1 values(1,1),(2,2),(3,3),(4,4);
delete from t1 where a=1 or a=0; delete from t1 where a=1 or a=0;
show keys from t1; show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 a NULL 3 NULL NULL HASH t1 0 PRIMARY 1 a NULL 3 NULL NULL HASH
select * from t1; select * from t1;
a b a b
......
...@@ -3,7 +3,7 @@ create table t1 (a int not null,b int not null, primary key using BTREE (a)) eng ...@@ -3,7 +3,7 @@ create table t1 (a int not null,b int not null, primary key using BTREE (a)) eng
insert into t1 values(1,1),(2,2),(3,3),(4,4); insert into t1 values(1,1),(2,2),(3,3),(4,4);
delete from t1 where a=1 or a=0; delete from t1 where a=1 or a=0;
show keys from t1; show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 a A NULL NULL NULL BTREE t1 0 PRIMARY 1 a A NULL NULL NULL BTREE
select * from t1; select * from t1;
a b a b
......
...@@ -3,7 +3,7 @@ create table t1 (a int not null,b int not null, primary key using HASH (a)) engi ...@@ -3,7 +3,7 @@ create table t1 (a int not null,b int not null, primary key using HASH (a)) engi
insert into t1 values(1,1),(2,2),(3,3),(4,4); insert into t1 values(1,1),(2,2),(3,3),(4,4);
delete from t1 where a=1 or a=0; delete from t1 where a=1 or a=0;
show keys from t1; show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 a NULL 3 NULL NULL HASH t1 0 PRIMARY 1 a NULL 3 NULL NULL HASH
select * from t1; select * from t1;
a b a b
...@@ -327,12 +327,12 @@ explain select * from t1 ignore index (btree_idx) where name='matt'; ...@@ -327,12 +327,12 @@ explain select * from t1 ignore index (btree_idx) where name='matt';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref heap_idx heap_idx 22 const 7 Using where 1 SIMPLE t1 ref heap_idx heap_idx 22 const 7 Using where
show index from t1; show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 id NULL 91 NULL NULL HASH t1 0 PRIMARY 1 id NULL 91 NULL NULL HASH
t1 1 heap_idx 1 name NULL 13 NULL NULL HASH t1 1 heap_idx 1 name NULL 13 NULL NULL HASH
t1 1 btree_idx 1 name A NULL NULL NULL BTREE t1 1 btree_idx 1 name A NULL NULL NULL BTREE
show index from t1; show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 id NULL 91 NULL NULL HASH t1 0 PRIMARY 1 id NULL 91 NULL NULL HASH
t1 1 heap_idx 1 name NULL 13 NULL NULL HASH t1 1 heap_idx 1 name NULL 13 NULL NULL HASH
t1 1 btree_idx 1 name A NULL NULL NULL BTREE t1 1 btree_idx 1 name A NULL NULL NULL BTREE
...@@ -344,11 +344,11 @@ key (a,b) ...@@ -344,11 +344,11 @@ key (a,b)
) engine=heap; ) engine=heap;
insert into t3 select name, name from t1; insert into t3 select name, name from t1;
show index from t3; show index from t3;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t3 1 a 1 a NULL NULL NULL NULL HASH t3 1 a 1 a NULL NULL NULL NULL HASH
t3 1 a 2 b NULL 13 NULL NULL HASH t3 1 a 2 b NULL 13 NULL NULL HASH
show index from t3; show index from t3;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t3 1 a 1 a NULL NULL NULL NULL HASH t3 1 a 1 a NULL NULL NULL NULL HASH
t3 1 a 2 b NULL 13 NULL NULL HASH t3 1 a 2 b NULL 13 NULL NULL HASH
explain select * from t1 ignore key(btree_idx), t3 where t1.name='matt' and t3.a = concat('',t1.name) and t3.b=t1.name; explain select * from t1 ignore key(btree_idx), t3 where t1.name='matt' and t3.a = concat('',t1.name) and t3.b=t1.name;
......
...@@ -169,10 +169,10 @@ table_name ...@@ -169,10 +169,10 @@ table_name
t1 t1
t4 t4
select * from information_schema.STATISTICS where TABLE_SCHEMA = "mysqltest"; select * from information_schema.STATISTICS where TABLE_SCHEMA = "mysqltest";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
def mysqltest t1 1 mysqltest string_data 1 b A NULL NULL NULL YES BTREE def mysqltest t1 1 mysqltest string_data 1 b A NULL NULL NULL YES BTREE
show keys from t3 where Key_name = "a_data"; show keys from t3 where Key_name = "a_data";
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t3 1 a_data 1 a A NULL NULL NULL YES BTREE t3 1 a_data 1 a A NULL NULL NULL YES BTREE
show tables like 't%'; show tables like 't%';
Tables_in_test (t%) Tables_in_test (t%)
...@@ -400,7 +400,7 @@ latin1_general_ci ...@@ -400,7 +400,7 @@ latin1_general_ci
latin1_general_cs latin1_general_cs
latin1_spanish_ci latin1_spanish_ci
show keys from v4; show keys from v4;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
select * from information_schema.views where TABLE_NAME like "v%"; select * from information_schema.views where TABLE_NAME like "v%";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
def test v0 select `information_schema`.`schemata`.`SCHEMA_NAME` AS `c` from `information_schema`.`schemata` NONE NO root@localhost DEFINER latin1 latin1_swedish_ci def test v0 select `information_schema`.`schemata`.`SCHEMA_NAME` AS `c` from `information_schema`.`schemata` NONE NO root@localhost DEFINER latin1 latin1_swedish_ci
...@@ -620,7 +620,7 @@ user ...@@ -620,7 +620,7 @@ user
drop view v1; drop view v1;
create view vo as select 'a' union select 'a'; create view vo as select 'a' union select 'a';
show index from vo; show index from vo;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
select * from information_schema.TABLE_CONSTRAINTS where select * from information_schema.TABLE_CONSTRAINTS where
TABLE_NAME= "vo"; TABLE_NAME= "vo";
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE
...@@ -1130,7 +1130,7 @@ describe t1; ...@@ -1130,7 +1130,7 @@ describe t1;
Field Type Null Key Default Extra Field Type Null Key Default Extra
f1 int(11) YES MUL NULL f1 int(11) YES MUL NULL
show indexes from t1; show indexes from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 f1 1 f1 A NULL NULL NULL YES BTREE t1 1 f1 1 f1 A NULL NULL NULL YES BTREE
drop table t1; drop table t1;
create table t1(f1 binary(32), f2 varbinary(64)); create table t1(f1 binary(32), f2 varbinary(64));
...@@ -1533,9 +1533,9 @@ CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME UNIQUE_CONSTRAINT_CATALOG U ...@@ -1533,9 +1533,9 @@ CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME UNIQUE_CONSTRAINT_CATALOG U
select * from information_schema.schemata where schema_name = NULL; select * from information_schema.schemata where schema_name = NULL;
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
select * from `information_schema`.`STATISTICS` where `TABLE_SCHEMA` = NULL; select * from `information_schema`.`STATISTICS` where `TABLE_SCHEMA` = NULL;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
select * from `information_schema`.`STATISTICS` where `TABLE_NAME` = NULL; select * from `information_schema`.`STATISTICS` where `TABLE_NAME` = NULL;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
select * from information_schema.tables where table_schema = NULL; select * from information_schema.tables where table_schema = NULL;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT
select * from information_schema.tables where table_catalog = NULL; select * from information_schema.tables where table_catalog = NULL;
......
...@@ -148,7 +148,7 @@ a 2 ...@@ -148,7 +148,7 @@ a 2
drop table t1; drop table t1;
create table t1 (a int not null unique, b int unique, c int, d int not null primary key, key(c), e int not null unique); create table t1 (a int not null unique, b int unique, c int, d int not null primary key, key(c), e int not null unique);
show keys from t1; show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 d A 0 NULL NULL BTREE t1 0 PRIMARY 1 d A 0 NULL NULL BTREE
t1 0 a 1 a A 0 NULL NULL BTREE t1 0 a 1 a A 0 NULL NULL BTREE
t1 0 e 1 e A 0 NULL NULL BTREE t1 0 e 1 e A 0 NULL NULL BTREE
......
...@@ -2072,7 +2072,7 @@ Warning 1684 Table 'test'.'t2' was skipped since its definition is being modifie ...@@ -2072,7 +2072,7 @@ Warning 1684 Table 'test'.'t2' was skipped since its definition is being modifie
select table_name, table_type, auto_increment, table_comment select table_name, table_type, auto_increment, table_comment
from information_schema.tables where table_schema='test' and table_name='t2'; from information_schema.tables where table_schema='test' and table_name='t2';
table_name table_type auto_increment table_comment table_name table_type auto_increment table_comment
t2 BASE TABLE NULL Table 'test'.'t2' was skipped since its definition is being modified by concurre t2 BASE TABLE NULL Table 'test'.'t2' was skipped since its definition is being modified by concurrent DDL statement
# Switching to connection 'default'. # Switching to connection 'default'.
unlock tables; unlock tables;
# Switching to connection 'con46044'. # Switching to connection 'con46044'.
......
...@@ -753,7 +753,7 @@ a b c ...@@ -753,7 +753,7 @@ a b c
1 1 1 1 1 1
1 1 0 1 1 0
show index from t3; show index from t3;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t3 1 a 1 a A NULL NULL NULL YES BTREE t3 1 a 1 a A NULL NULL NULL YES BTREE
t3 1 a 2 b A NULL NULL NULL YES BTREE t3 1 a 2 b A NULL NULL NULL YES BTREE
t3 1 a 3 c A NULL NULL NULL YES BTREE t3 1 a 3 c A NULL NULL NULL YES BTREE
...@@ -2044,7 +2044,7 @@ CREATE TABLE tm1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1) INSERT_METHOD=FIRST; ...@@ -2044,7 +2044,7 @@ CREATE TABLE tm1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1) INSERT_METHOD=FIRST;
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE
TABLE_SCHEMA = 'test' and TABLE_NAME='tm1'; TABLE_SCHEMA = 'test' and TABLE_NAME='tm1';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT
def test tm1 BASE TABLE NULL NULL NULL # # # # # # # # # # NULL # # Unable to open underlying table which is differently defined or of non-MyISAM ty def test tm1 BASE TABLE NULL NULL NULL # # # # # # # # # # NULL # # Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
DROP TABLE tm1; DROP TABLE tm1;
CREATE TABLE t1(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2)) ENGINE=MYISAM; CREATE TABLE t1(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2)) ENGINE=MYISAM;
CREATE TABLE t2(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2)) ENGINE=MYISAM; CREATE TABLE t2(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2)) ENGINE=MYISAM;
......
...@@ -169,7 +169,7 @@ optimize table t1; ...@@ -169,7 +169,7 @@ optimize table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 optimize status OK test.t1 optimize status OK
show keys from t1; show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 id A # NULL NULL BTREE t1 0 PRIMARY 1 id A # NULL NULL BTREE
t1 1 parent_id 1 parent_id A # NULL NULL BTREE t1 1 parent_id 1 parent_id A # NULL NULL BTREE
t1 1 level 1 level A # NULL NULL BTREE t1 1 level 1 level A # NULL NULL BTREE
...@@ -212,7 +212,7 @@ analyze table t1; ...@@ -212,7 +212,7 @@ analyze table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze status OK test.t1 analyze status OK
show keys from t1; show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 skr 1 a A # NULL NULL YES BTREE t1 1 skr 1 a A # NULL NULL YES BTREE
drop table t1; drop table t1;
create table t1 (a int,b varchar(20),key(a)) engine=MyISAM; create table t1 (a int,b varchar(20),key(a)) engine=MyISAM;
...@@ -257,7 +257,7 @@ drop table t1; ...@@ -257,7 +257,7 @@ drop table t1;
CREATE TABLE t1 (a int not null, b int not null,c int not null, CREATE TABLE t1 (a int not null, b int not null,c int not null,
key(a),primary key(a,b), unique(c),key(a),unique(b)) ENGINE = MyISAM; key(a),primary key(a,b), unique(c),key(a),unique(b)) ENGINE = MyISAM;
show index from t1; show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 a A # NULL NULL BTREE t1 0 PRIMARY 1 a A # NULL NULL BTREE
t1 0 PRIMARY 2 b A # NULL NULL BTREE t1 0 PRIMARY 2 b A # NULL NULL BTREE
t1 0 c 1 c A # NULL NULL BTREE t1 0 c 1 c A # NULL NULL BTREE
...@@ -635,7 +635,7 @@ optimize table t1; ...@@ -635,7 +635,7 @@ optimize table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 optimize status OK test.t1 optimize status OK
show keys from t1; show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 a A # NULL NULL BTREE t1 0 PRIMARY 1 a A # NULL NULL BTREE
drop table t1; drop table t1;
create table t1 (i int, j int ) ENGINE=MyISAM; create table t1 (i int, j int ) ENGINE=MyISAM;
......
...@@ -38,14 +38,14 @@ optimize table t1; ...@@ -38,14 +38,14 @@ optimize table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 optimize status OK test.t1 optimize status OK
show index from t1; show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 a A 5 NULL NULL BTREE t1 0 PRIMARY 1 a A 5 NULL NULL BTREE
t1 1 b 1 b A 1 NULL NULL BTREE t1 1 b 1 b A 1 NULL NULL BTREE
optimize table t1; optimize table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 optimize status Table is already up to date test.t1 optimize status Table is already up to date
show index from t1; show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 a A 5 NULL NULL BTREE t1 0 PRIMARY 1 a A 5 NULL NULL BTREE
t1 1 b 1 b A 1 NULL NULL BTREE t1 1 b 1 b A 1 NULL NULL BTREE
drop table t1; drop table t1;
...@@ -336,7 +336,7 @@ optimize table t1; ...@@ -336,7 +336,7 @@ optimize table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 optimize status OK test.t1 optimize status OK
show index from t1; show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 b 1 b A 5 NULL NULL YES BTREE t1 1 b 1 b A 5 NULL NULL YES BTREE
t1 1 c 1 c A 5 NULL NULL YES BTREE t1 1 c 1 c A 5 NULL NULL YES BTREE
t1 1 a 1 a A 1 NULL NULL BTREE t1 1 a 1 a A 1 NULL NULL BTREE
...@@ -575,28 +575,28 @@ Error 1146 Table 'test.t3' doesn't exist ...@@ -575,28 +575,28 @@ Error 1146 Table 'test.t3' doesn't exist
drop table t1,t2; drop table t1,t2;
create table t1 (a int, key (a)); create table t1 (a int, key (a));
show keys from t1; show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A NULL NULL NULL YES BTREE t1 1 a 1 a A NULL NULL NULL YES BTREE
alter table t1 disable keys; alter table t1 disable keys;
show keys from t1; show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A NULL NULL NULL YES BTREE disabled t1 1 a 1 a A NULL NULL NULL YES BTREE disabled
create table t2 (a int); create table t2 (a int);
set @@rand_seed1=31415926,@@rand_seed2=2718281828; set @@rand_seed1=31415926,@@rand_seed2=2718281828;
insert t1 select * from t2; insert t1 select * from t2;
show keys from t1; show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A NULL NULL NULL YES BTREE disabled t1 1 a 1 a A NULL NULL NULL YES BTREE disabled
alter table t1 enable keys; alter table t1 enable keys;
show keys from t1; show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A 1000 NULL NULL YES BTREE t1 1 a 1 a A 1000 NULL NULL YES BTREE
alter table t1 engine=heap; alter table t1 engine=heap;
alter table t1 disable keys; alter table t1 disable keys;
Warnings: Warnings:
Note 1031 Table storage engine for 't1' doesn't have this option Note 1031 Table storage engine for 't1' doesn't have this option
show keys from t1; show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a NULL 500 NULL NULL YES HASH t1 1 a 1 a NULL 500 NULL NULL YES HASH
drop table t1,t2; drop table t1,t2;
create table t1 ( a tinytext, b char(1), index idx (a(1),b) ); create table t1 ( a tinytext, b char(1), index idx (a(1),b) );
...@@ -640,7 +640,7 @@ analyze table t1; ...@@ -640,7 +640,7 @@ analyze table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze status OK test.t1 analyze status OK
show index from t1; show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A 10 NULL NULL YES BTREE t1 1 a 1 a A 10 NULL NULL YES BTREE
insert into t1 values (11); insert into t1 values (11);
delete from t1 where a=11; delete from t1 where a=11;
...@@ -648,7 +648,7 @@ check table t1; ...@@ -648,7 +648,7 @@ check table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
show index from t1; show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A 10 NULL NULL YES BTREE t1 1 a 1 a A 10 NULL NULL YES BTREE
set myisam_stats_method=nulls_equal; set myisam_stats_method=nulls_equal;
show variables like 'myisam_stats_method'; show variables like 'myisam_stats_method';
...@@ -660,7 +660,7 @@ analyze table t1; ...@@ -660,7 +660,7 @@ analyze table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze status OK test.t1 analyze status OK
show index from t1; show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A 5 NULL NULL YES BTREE t1 1 a 1 a A 5 NULL NULL YES BTREE
insert into t1 values (11); insert into t1 values (11);
delete from t1 where a=11; delete from t1 where a=11;
...@@ -668,7 +668,7 @@ check table t1; ...@@ -668,7 +668,7 @@ check table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
show index from t1; show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A 5 NULL NULL YES BTREE t1 1 a 1 a A 5 NULL NULL YES BTREE
set myisam_stats_method=DEFAULT; set myisam_stats_method=DEFAULT;
show variables like 'myisam_stats_method'; show variables like 'myisam_stats_method';
...@@ -680,7 +680,7 @@ analyze table t1; ...@@ -680,7 +680,7 @@ analyze table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze status OK test.t1 analyze status OK
show index from t1; show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A 10 NULL NULL YES BTREE t1 1 a 1 a A 10 NULL NULL YES BTREE
insert into t1 values (11); insert into t1 values (11);
delete from t1 where a=11; delete from t1 where a=11;
...@@ -688,7 +688,7 @@ check table t1; ...@@ -688,7 +688,7 @@ check table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
show index from t1; show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A 10 NULL NULL YES BTREE t1 1 a 1 a A 10 NULL NULL YES BTREE
drop table t1; drop table t1;
set myisam_stats_method=nulls_ignored; set myisam_stats_method=nulls_ignored;
...@@ -707,7 +707,7 @@ analyze table t1; ...@@ -707,7 +707,7 @@ analyze table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze status OK test.t1 analyze status OK
show index from t1; show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A 2 NULL NULL YES BTREE t1 1 a 1 a A 2 NULL NULL YES BTREE
t1 1 a 2 b A 4 NULL NULL YES BTREE t1 1 a 2 b A 4 NULL NULL YES BTREE
t1 1 a 3 c A 4 NULL NULL YES BTREE t1 1 a 3 c A 4 NULL NULL YES BTREE
...@@ -717,7 +717,7 @@ analyze table t1; ...@@ -717,7 +717,7 @@ analyze table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze status OK test.t1 analyze status OK
show index from t1; show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A 0 NULL NULL YES BTREE t1 1 a 1 a A 0 NULL NULL YES BTREE
t1 1 a 2 b A 0 NULL NULL YES BTREE t1 1 a 2 b A 0 NULL NULL YES BTREE
t1 1 a 3 c A 0 NULL NULL YES BTREE t1 1 a 3 c A 0 NULL NULL YES BTREE
...@@ -1738,12 +1738,12 @@ analyze table t1; ...@@ -1738,12 +1738,12 @@ analyze table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze status OK test.t1 analyze status OK
show keys from t1; show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A 8 NULL NULL YES BTREE t1 1 a 1 a A 8 NULL NULL YES BTREE
alter table t1 disable keys; alter table t1 disable keys;
alter table t1 enable keys; alter table t1 enable keys;
show keys from t1; show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A 8 NULL NULL YES BTREE t1 1 a 1 a A 8 NULL NULL YES BTREE
drop table t1; drop table t1;
create table t1 (c1 int) engine=myisam pack_keys=0; create table t1 (c1 int) engine=myisam pack_keys=0;
......
...@@ -15,7 +15,7 @@ INSERT INTO t1 VALUES (1), (2); ...@@ -15,7 +15,7 @@ INSERT INTO t1 VALUES (1), (2);
<database name="test"> <database name="test">
<table_structure name="t1"> <table_structure name="t1">
<field Field="a" Type="int(11)" Null="YES" Key="MUL" Extra="" /> <field Field="a" Type="int(11)" Null="YES" Key="MUL" Extra="" />
<key Table="t1" Non_unique="1" Key_name="a" Seq_in_index="1" Column_name="a" Collation="A" Null="YES" Index_type="BTREE" Comment="" /> <key Table="t1" Non_unique="1" Key_name="a" Seq_in_index="1" Column_name="a" Collation="A" Null="YES" Index_type="BTREE" Comment="" Index_comment="" />
</table_structure> </table_structure>
<table_data name="t1"> <table_data name="t1">
<row> <row>
...@@ -3631,7 +3631,7 @@ CREATE TEMPORARY TABLE `TABLES` ( ...@@ -3631,7 +3631,7 @@ CREATE TEMPORARY TABLE `TABLES` (
`TABLE_COLLATION` varchar(32) DEFAULT NULL, `TABLE_COLLATION` varchar(32) DEFAULT NULL,
`CHECKSUM` bigint(21) unsigned DEFAULT NULL, `CHECKSUM` bigint(21) unsigned DEFAULT NULL,
`CREATE_OPTIONS` varchar(255) DEFAULT NULL, `CREATE_OPTIONS` varchar(255) DEFAULT NULL,
`TABLE_COMMENT` varchar(80) NOT NULL DEFAULT '' `TABLE_COMMENT` varchar(2048) NOT NULL DEFAULT ''
) ENGINE=MEMORY DEFAULT CHARSET=utf8; ) ENGINE=MEMORY DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
# #
......
...@@ -2084,7 +2084,7 @@ fld6 char(4) latin1_swedish_ci NO # ...@@ -2084,7 +2084,7 @@ fld6 char(4) latin1_swedish_ci NO #
show full columns from t2 from test like 's%'; show full columns from t2 from test like 's%';
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
show keys from t2; show keys from t2;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE
t2 0 fld1 1 fld1 A 1199 NULL NULL BTREE t2 0 fld1 1 fld1 A 1199 NULL NULL BTREE
t2 1 fld3 1 fld3 A NULL NULL NULL BTREE t2 1 fld3 1 fld3 A NULL NULL NULL BTREE
......
...@@ -69,13 +69,13 @@ partition by list (a) ...@@ -69,13 +69,13 @@ partition by list (a)
partition p1 values in (2)); partition p1 values in (2));
insert into t1 values (1,1),(2,1),(2,2),(2,3); insert into t1 values (1,1),(2,1),(2,2),(2,3);
show indexes from t1; show indexes from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A NULL NULL NULL YES BTREE t1 1 a 1 a A NULL NULL NULL YES BTREE
analyze table t1; analyze table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze status OK test.t1 analyze status OK
show indexes from t1; show indexes from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A 1 NULL NULL YES BTREE t1 1 a 1 a A 1 NULL NULL YES BTREE
drop table t1; drop table t1;
create table t1 (a int) create table t1 (a int)
......
...@@ -290,7 +290,7 @@ a int(11) NO PRI NULL ...@@ -290,7 +290,7 @@ a int(11) NO PRI NULL
create index t2_idx on t2(b); create index t2_idx on t2(b);
prepare stmt4 from ' show index from t2 from test '; prepare stmt4 from ' show index from t2 from test ';
execute stmt4; execute stmt4;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t2 0 PRIMARY 1 a A 0 NULL NULL BTREE t2 0 PRIMARY 1 a A 0 NULL NULL BTREE
t2 1 t2_idx 1 b A NULL NULL NULL YES BTREE t2 1 t2_idx 1 b A NULL NULL NULL YES BTREE
prepare stmt4 from ' show table status from test like ''t2%'' '; prepare stmt4 from ' show table status from test like ''t2%'' ';
......
...@@ -2089,11 +2089,11 @@ drop table if exists t1; ...@@ -2089,11 +2089,11 @@ drop table if exists t1;
create table t1 (a int); create table t1 (a int);
prepare stmt from "show keys from t1 where (1) in (select * from t1)"; prepare stmt from "show keys from t1 where (1) in (select * from t1)";
execute stmt; execute stmt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
drop table t1; drop table t1;
create table t1 (x int); create table t1 (x int);
execute stmt; execute stmt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
drop table t1; drop table t1;
deallocate prepare stmt; deallocate prepare stmt;
# #
......
...@@ -13,14 +13,14 @@ create table t1(id int PRIMARY KEY, st varchar(10), KEY st_key(st)); ...@@ -13,14 +13,14 @@ create table t1(id int PRIMARY KEY, st varchar(10), KEY st_key(st));
insert into t1 values(1, "One"); insert into t1 values(1, "One");
alter table t1 disable keys; alter table t1 disable keys;
show keys from t1; show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 id A 1 NULL NULL BTREE t1 0 PRIMARY 1 id A 1 NULL NULL BTREE
t1 1 st_key 1 st A NULL NULL NULL YES BTREE disabled t1 1 st_key 1 st A NULL NULL NULL YES BTREE disabled
repair table t1 extended; repair table t1 extended;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 repair status OK test.t1 repair status OK
show keys from t1; show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 id A 1 NULL NULL BTREE t1 0 PRIMARY 1 id A 1 NULL NULL BTREE
t1 1 st_key 1 st A NULL NULL NULL YES BTREE disabled t1 1 st_key 1 st A NULL NULL NULL YES BTREE disabled
drop table t1; drop table t1;
...@@ -46,7 +46,7 @@ REPAIR TABLE t1; ...@@ -46,7 +46,7 @@ REPAIR TABLE t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 repair status OK test.t1 repair status OK
SHOW INDEX FROM t1; SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A 5 NULL NULL YES BTREE t1 1 a 1 a A 5 NULL NULL YES BTREE
SET myisam_repair_threads=@@global.myisam_repair_threads; SET myisam_repair_threads=@@global.myisam_repair_threads;
DROP TABLE t1; DROP TABLE t1;
......
...@@ -2086,7 +2086,7 @@ fld6 char(4) latin1_swedish_ci NO # ...@@ -2086,7 +2086,7 @@ fld6 char(4) latin1_swedish_ci NO #
show full columns from t2 from test like 's%'; show full columns from t2 from test like 's%';
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
show keys from t2; show keys from t2;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE
t2 0 fld1 1 fld1 A 1199 NULL NULL BTREE t2 0 fld1 1 fld1 A 1199 NULL NULL BTREE
t2 1 fld3 1 fld3 A NULL NULL NULL BTREE t2 1 fld3 1 fld3 A NULL NULL NULL BTREE
......
...@@ -2084,7 +2084,7 @@ fld6 char(4) latin1_swedish_ci NO # ...@@ -2084,7 +2084,7 @@ fld6 char(4) latin1_swedish_ci NO #
show full columns from t2 from test like 's%'; show full columns from t2 from test like 's%';
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
show keys from t2; show keys from t2;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE
t2 0 fld1 1 fld1 A 1199 NULL NULL BTREE t2 0 fld1 1 fld1 A 1199 NULL NULL BTREE
t2 1 fld3 1 fld3 A NULL NULL NULL BTREE t2 1 fld3 1 fld3 A NULL NULL NULL BTREE
......
...@@ -73,7 +73,8 @@ def information_schema STATISTICS STATISTICS PACKED Packed 253 10 0 Y 0 0 8 ...@@ -73,7 +73,8 @@ def information_schema STATISTICS STATISTICS PACKED Packed 253 10 0 Y 0 0 8
def information_schema STATISTICS STATISTICS NULLABLE Null 253 3 0 N 1 0 8 def information_schema STATISTICS STATISTICS NULLABLE Null 253 3 0 N 1 0 8
def information_schema STATISTICS STATISTICS INDEX_TYPE Index_type 253 16 5 N 1 0 8 def information_schema STATISTICS STATISTICS INDEX_TYPE Index_type 253 16 5 N 1 0 8
def information_schema STATISTICS STATISTICS COMMENT Comment 253 16 0 Y 0 0 8 def information_schema STATISTICS STATISTICS COMMENT Comment 253 16 0 Y 0 0 8
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment def information_schema STATISTICS STATISTICS INDEX_COMMENT Index_comment 253 1024 0 N 1 0 8
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 a A 5 NULL NULL BTREE t1 0 PRIMARY 1 a A 5 NULL NULL BTREE
t1 1 b 1 b A 1 NULL NULL BTREE t1 1 b 1 b A 1 NULL NULL BTREE
t1 1 b 2 c A 5 NULL NULL BTREE t1 1 b 2 c A 5 NULL NULL BTREE
...@@ -133,7 +134,7 @@ def information_schema TABLES TABLES CHECK_TIME Check_time 12 19 0 Y 128 0 63 ...@@ -133,7 +134,7 @@ def information_schema TABLES TABLES CHECK_TIME Check_time 12 19 0 Y 128 0 63
def information_schema TABLES TABLES TABLE_COLLATION Collation 253 32 0 Y 0 0 8 def information_schema TABLES TABLES TABLE_COLLATION Collation 253 32 0 Y 0 0 8
def information_schema TABLES TABLES CHECKSUM Checksum 8 21 0 Y 32800 0 63 def information_schema TABLES TABLES CHECKSUM Checksum 8 21 0 Y 32800 0 63
def information_schema TABLES TABLES CREATE_OPTIONS Create_options 253 255 0 Y 0 0 8 def information_schema TABLES TABLES CREATE_OPTIONS Create_options 253 255 0 Y 0 0 8
def information_schema TABLES TABLES TABLE_COMMENT Comment 253 80 0 N 1 0 8 def information_schema TABLES TABLES TABLE_COMMENT Comment 253 2048 0 N 1 0 8
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 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
show databases; show databases;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
...@@ -163,7 +164,7 @@ def Msg_text 253 255 2 Y 0 31 8 ...@@ -163,7 +164,7 @@ def Msg_text 253 255 2 Y 0 31 8
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze status OK test.t1 analyze status OK
show index from t1; show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 f1 A 1 NULL NULL BTREE t1 0 PRIMARY 1 f1 A 1 NULL NULL BTREE
t1 0 PRIMARY 2 f2 A 3 NULL NULL BTREE t1 0 PRIMARY 2 f2 A 3 NULL NULL BTREE
t1 0 PRIMARY 3 f3 A 9 NULL NULL BTREE t1 0 PRIMARY 3 f3 A 9 NULL NULL BTREE
...@@ -180,7 +181,7 @@ def Msg_text 253 255 2 Y 0 31 8 ...@@ -180,7 +181,7 @@ def Msg_text 253 255 2 Y 0 31 8
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 repair status OK test.t1 repair status OK
show index from t1; show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 f1 A 1 NULL NULL BTREE t1 0 PRIMARY 1 f1 A 1 NULL NULL BTREE
t1 0 PRIMARY 2 f2 A 3 NULL NULL BTREE t1 0 PRIMARY 2 f2 A 3 NULL NULL BTREE
t1 0 PRIMARY 3 f3 A 9 NULL NULL BTREE t1 0 PRIMARY 3 f3 A 9 NULL NULL BTREE
...@@ -639,7 +640,8 @@ def information_schema STATISTICS STATISTICS PACKED Packed 253 10 0 Y 0 0 63 ...@@ -639,7 +640,8 @@ def information_schema STATISTICS STATISTICS PACKED Packed 253 10 0 Y 0 0 63
def information_schema STATISTICS STATISTICS NULLABLE Null 253 3 0 N 1 0 63 def information_schema STATISTICS STATISTICS NULLABLE Null 253 3 0 N 1 0 63
def information_schema STATISTICS STATISTICS INDEX_TYPE Index_type 253 16 5 N 1 0 63 def information_schema STATISTICS STATISTICS INDEX_TYPE Index_type 253 16 5 N 1 0 63
def information_schema STATISTICS STATISTICS COMMENT Comment 253 16 0 Y 0 0 63 def information_schema STATISTICS STATISTICS COMMENT Comment 253 16 0 Y 0 0 63
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment def information_schema STATISTICS STATISTICS INDEX_COMMENT Index_comment 253 1024 0 N 1 0 63
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 field1 A 0 1000 NULL BTREE t1 0 PRIMARY 1 field1 A 0 1000 NULL BTREE
drop table t1; drop table t1;
create table t1 ( create table t1 (
...@@ -904,7 +906,8 @@ def information_schema STATISTICS STATISTICS PACKED Packed 253 30 0 Y 0 0 33 ...@@ -904,7 +906,8 @@ def information_schema STATISTICS STATISTICS PACKED Packed 253 30 0 Y 0 0 33
def information_schema STATISTICS STATISTICS NULLABLE Null 253 9 0 N 1 0 33 def information_schema STATISTICS STATISTICS NULLABLE Null 253 9 0 N 1 0 33
def information_schema STATISTICS STATISTICS INDEX_TYPE Index_type 253 48 5 N 1 0 33 def information_schema STATISTICS STATISTICS INDEX_TYPE Index_type 253 48 5 N 1 0 33
def information_schema STATISTICS STATISTICS COMMENT Comment 253 48 0 Y 0 0 33 def information_schema STATISTICS STATISTICS COMMENT Comment 253 48 0 Y 0 0 33
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment def information_schema STATISTICS STATISTICS INDEX_COMMENT Index_comment 253 3072 0 N 1 0 33
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 c A 0 NULL NULL BTREE t1 0 PRIMARY 1 c A 0 NULL NULL BTREE
---------------------------------------------------------------- ----------------------------------------------------------------
SELECT SELECT
...@@ -928,7 +931,7 @@ def information_schema TABLES TABLES ENGINE ENGINE 253 192 6 Y 0 0 33 ...@@ -928,7 +931,7 @@ def information_schema TABLES TABLES ENGINE ENGINE 253 192 6 Y 0 0 33
def information_schema TABLES TABLES ROW_FORMAT ROW_FORMAT 253 30 5 Y 0 0 33 def information_schema TABLES TABLES ROW_FORMAT ROW_FORMAT 253 30 5 Y 0 0 33
def information_schema TABLES TABLES TABLE_COLLATION TABLE_COLLATION 253 96 17 Y 0 0 33 def information_schema TABLES TABLES TABLE_COLLATION TABLE_COLLATION 253 96 17 Y 0 0 33
def information_schema TABLES TABLES CREATE_OPTIONS CREATE_OPTIONS 253 765 0 Y 0 0 33 def information_schema TABLES TABLES CREATE_OPTIONS CREATE_OPTIONS 253 765 0 Y 0 0 33
def information_schema TABLES TABLES TABLE_COMMENT TABLE_COMMENT 253 240 0 N 1 0 33 def information_schema TABLES TABLES TABLE_COMMENT TABLE_COMMENT 253 6144 0 N 1 0 33
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE ROW_FORMAT TABLE_COLLATION CREATE_OPTIONS TABLE_COMMENT TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE ROW_FORMAT TABLE_COLLATION CREATE_OPTIONS TABLE_COMMENT
def test t1 BASE TABLE MyISAM Fixed latin1_swedish_ci def test t1 BASE TABLE MyISAM Fixed latin1_swedish_ci
---------------------------------------------------------------- ----------------------------------------------------------------
...@@ -963,7 +966,7 @@ def information_schema COLUMNS COLUMNS COLUMN_TYPE COLUMN_TYPE 252 589815 7 N 17 ...@@ -963,7 +966,7 @@ def information_schema COLUMNS COLUMNS COLUMN_TYPE COLUMN_TYPE 252 589815 7 N 17
def information_schema COLUMNS COLUMNS COLUMN_KEY COLUMN_KEY 253 9 3 N 1 0 33 def information_schema COLUMNS COLUMNS COLUMN_KEY COLUMN_KEY 253 9 3 N 1 0 33
def information_schema COLUMNS COLUMNS EXTRA EXTRA 253 81 0 N 1 0 33 def information_schema COLUMNS COLUMNS EXTRA EXTRA 253 81 0 N 1 0 33
def information_schema COLUMNS COLUMNS PRIVILEGES PRIVILEGES 253 240 31 N 1 0 33 def information_schema COLUMNS COLUMNS PRIVILEGES PRIVILEGES 253 240 31 N 1 0 33
def information_schema COLUMNS COLUMNS COLUMN_COMMENT COLUMN_COMMENT 253 765 0 N 1 0 33 def information_schema COLUMNS COLUMNS COLUMN_COMMENT COLUMN_COMMENT 253 3072 0 N 1 0 33
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
def test t1 c NULL NO int NULL NULL int(11) PRI select,insert,update,references def test t1 c NULL NO int NULL NULL int(11) PRI select,insert,update,references
---------------------------------------------------------------- ----------------------------------------------------------------
...@@ -1295,7 +1298,7 @@ show columns from `a\b` from `mysqlttest\1`; ...@@ -1295,7 +1298,7 @@ show columns from `a\b` from `mysqlttest\1`;
Field Type Null Key Default Extra Field Type Null Key Default Extra
a int(11) YES NULL a int(11) YES NULL
show keys from `mysqlttest\1`.`a\b`; show keys from `mysqlttest\1`.`a\b`;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
drop table `mysqlttest\1`.`a\b`; drop table `mysqlttest\1`.`a\b`;
drop database `mysqlttest\1`; drop database `mysqlttest\1`;
show engine foobar status; show engine foobar status;
......
...@@ -2404,7 +2404,7 @@ Level Code Message ...@@ -2404,7 +2404,7 @@ Level Code Message
Field Type Null Key Default Extra Field Type Null Key Default Extra
id char(16) NO id char(16) NO
data int(11) NO NULL data int(11) NO NULL
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
Database Table In_use Name_locked Database Table In_use Name_locked
Variable_name Value Variable_name Value
Tables_in_test (foo) Tables_in_test (foo)
...@@ -2425,7 +2425,7 @@ Level Code Message ...@@ -2425,7 +2425,7 @@ Level Code Message
Field Type Null Key Default Extra Field Type Null Key Default Extra
id char(16) NO id char(16) NO
data int(11) NO NULL data int(11) NO NULL
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
Database Table In_use Name_locked Database Table In_use Name_locked
Variable_name Value Variable_name Value
Tables_in_test (foo) Tables_in_test (foo)
......
...@@ -2087,7 +2087,7 @@ fld6 char(4) latin1_swedish_ci NO # ...@@ -2087,7 +2087,7 @@ fld6 char(4) latin1_swedish_ci NO #
show full columns from t2 from test like 's%'; show full columns from t2 from test like 's%';
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
show keys from t2; show keys from t2;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE
t2 0 fld1 1 fld1 A 1199 NULL NULL BTREE t2 0 fld1 1 fld1 A 1199 NULL NULL BTREE
t2 1 fld3 1 fld3 A NULL NULL NULL BTREE t2 1 fld3 1 fld3 A NULL NULL NULL BTREE
......
...@@ -2090,7 +2090,7 @@ fld6 char(4) latin1_swedish_ci NO # ...@@ -2090,7 +2090,7 @@ fld6 char(4) latin1_swedish_ci NO #
show full columns from t2 from test like 's%'; show full columns from t2 from test like 's%';
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
show keys from t2; show keys from t2;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE
t2 0 fld1 1 fld1 A 1199 NULL NULL BTREE t2 0 fld1 1 fld1 A 1199 NULL NULL BTREE
t2 1 fld3 1 fld3 A NULL NULL NULL BTREE t2 1 fld3 1 fld3 A NULL NULL NULL BTREE
......
...@@ -1304,22 +1304,96 @@ set @@sql_mode= @org_mode; ...@@ -1304,22 +1304,96 @@ set @@sql_mode= @org_mode;
set @@sql_mode='traditional'; set @@sql_mode='traditional';
create table t1 (i int) create table t1 (i int)
comment '123456789*123456789*123456789*123456789*123456789* comment '123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*'; 123456789*123456789*123456789*123456789*123456789*';
ERROR HY000: Comment for table 't1' is too long (max = 60) ERROR HY000: Comment for table 't1' is too long (max = 2048)
create table t1 ( create table t1 (
i int comment i int comment
'123456789*123456789*123456789*123456789* '123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789* 123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789* 123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789* 123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789* 123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789* 123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*'); 123456789*123456789*123456789*123456789*');
ERROR HY000: Comment for field 'i' is too long (max = 255) ERROR HY000: Comment for field 'i' is too long (max = 1024)
set @@sql_mode= @org_mode; set @@sql_mode= @org_mode;
create table t1 create table t1
(i int comment (i int comment
'123456789*123456789*123456789*123456789* '123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789* 123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789* 123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789* 123456789*123456789*123456789*123456789*
...@@ -1327,7 +1401,7 @@ create table t1 ...@@ -1327,7 +1401,7 @@ create table t1
123456789*123456789*123456789*123456789* 123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*'); 123456789*123456789*123456789*123456789*');
Warnings: Warnings:
Warning 1629 Comment for field 'i' is too long (max = 255) Warning 1629 Comment for field 'i' is too long (max = 1024)
select column_name, column_comment from information_schema.columns where select column_name, column_comment from information_schema.columns where
table_schema = 'test' and table_name = 't1'; table_schema = 'test' and table_name = 't1';
column_name column_comment column_name column_comment
...@@ -1337,6 +1411,24 @@ i 123456789*123456789*123456789*123456789* ...@@ -1337,6 +1411,24 @@ i 123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789* 123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789* 123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789* 123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*12345
drop table t1; drop table t1;
set names utf8; set names utf8;
create table t1 (i int) create table t1 (i int)
......
...@@ -68,7 +68,7 @@ longblob_col longblob NULL NO NULL # ...@@ -68,7 +68,7 @@ longblob_col longblob NULL NO NULL #
options enum('one','two','tree') latin1_swedish_ci NO MUL NULL # options enum('one','two','tree') latin1_swedish_ci NO MUL NULL #
flags set('one','two','tree') latin1_swedish_ci NO # flags set('one','two','tree') latin1_swedish_ci NO #
show keys from t1; show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 auto A 0 NULL NULL BTREE t1 0 PRIMARY 1 auto A 0 NULL NULL BTREE
t1 1 utiny 1 utiny A NULL NULL NULL BTREE t1 1 utiny 1 utiny A NULL NULL NULL BTREE
t1 1 tiny 1 tiny A NULL NULL NULL BTREE t1 1 tiny 1 tiny A NULL NULL NULL BTREE
......
...@@ -839,7 +839,7 @@ ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function ...@@ -839,7 +839,7 @@ ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function
show table status; show table status;
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 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
t1 MyISAM 10 Fixed 0 0 0 # 1024 0 NULL # # NULL latin1_swedish_ci NULL t1 MyISAM 10 Fixed 0 0 0 # 1024 0 NULL # # NULL latin1_swedish_ci NULL
v1 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL View 'test.v1' references invalid table(s) or column(s) or function(s) or define v1 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
drop view v1; drop view v1;
drop table t1; drop table t1;
create view v1 as select 99999999999999999999999999999999999999999999999999999 as col1; create view v1 as select 99999999999999999999999999999999999999999999999999999 as col1;
...@@ -3685,7 +3685,7 @@ c1 c2 ...@@ -3685,7 +3685,7 @@ c1 c2
2 2 2 2
CREATE VIEW v1 AS SELECT c1, c2 FROM t1; CREATE VIEW v1 AS SELECT c1, c2 FROM t1;
SHOW INDEX FROM v1; SHOW INDEX FROM v1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
SELECT * FROM v1 USE INDEX (PRIMARY) WHERE c1=2; SELECT * FROM v1 USE INDEX (PRIMARY) WHERE c1=2;
ERROR 42000: Key 'PRIMARY' doesn't exist in table 'v1' ERROR 42000: Key 'PRIMARY' doesn't exist in table 'v1'
SELECT * FROM v1 FORCE INDEX (PRIMARY) WHERE c1=2; SELECT * FROM v1 FORCE INDEX (PRIMARY) WHERE c1=2;
......
...@@ -63,7 +63,7 @@ INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'), ...@@ -63,7 +63,7 @@ INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
('Function MATCH ... AGAINST()','is used to do a search'), ('Function MATCH ... AGAINST()','is used to do a search'),
('Full-text search in MySQL', 'implements vector space model'); ('Full-text search in MySQL', 'implements vector space model');
SHOW INDEX FROM t1; SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a NULL NULL NULL NULL YES FULLTEXT t1 1 a 1 a NULL NULL NULL NULL YES FULLTEXT
t1 1 a 2 b NULL NULL NULL NULL YES FULLTEXT t1 1 a 2 b NULL NULL NULL NULL YES FULLTEXT
select * from t1 where MATCH(a,b) AGAINST ("collections"); select * from t1 where MATCH(a,b) AGAINST ("collections");
......
...@@ -46,7 +46,7 @@ COLUMN_TYPE longtext NO NULL ...@@ -46,7 +46,7 @@ COLUMN_TYPE longtext NO NULL
COLUMN_KEY varchar(3) NO COLUMN_KEY varchar(3) NO
EXTRA varchar(27) NO EXTRA varchar(27) NO
PRIVILEGES varchar(80) NO PRIVILEGES varchar(80) NO
COLUMN_COMMENT varchar(255) NO COLUMN_COMMENT varchar(1024) NO
SHOW CREATE TABLE information_schema.COLUMNS; SHOW CREATE TABLE information_schema.COLUMNS;
Table Create Table Table Create Table
COLUMNS CREATE TEMPORARY TABLE `COLUMNS` ( COLUMNS CREATE TEMPORARY TABLE `COLUMNS` (
...@@ -68,7 +68,7 @@ COLUMNS CREATE TEMPORARY TABLE `COLUMNS` ( ...@@ -68,7 +68,7 @@ COLUMNS CREATE TEMPORARY TABLE `COLUMNS` (
`COLUMN_KEY` varchar(3) NOT NULL DEFAULT '', `COLUMN_KEY` varchar(3) NOT NULL DEFAULT '',
`EXTRA` varchar(27) NOT NULL DEFAULT '', `EXTRA` varchar(27) NOT NULL DEFAULT '',
`PRIVILEGES` varchar(80) NOT NULL DEFAULT '', `PRIVILEGES` varchar(80) NOT NULL DEFAULT '',
`COLUMN_COMMENT` varchar(255) NOT NULL DEFAULT '' `COLUMN_COMMENT` varchar(1024) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ) ENGINE=MyISAM DEFAULT CHARSET=utf8
SHOW COLUMNS FROM information_schema.COLUMNS; SHOW COLUMNS FROM information_schema.COLUMNS;
Field Type Null Key Default Extra Field Type Null Key Default Extra
...@@ -90,7 +90,7 @@ COLUMN_TYPE longtext NO NULL ...@@ -90,7 +90,7 @@ COLUMN_TYPE longtext NO NULL
COLUMN_KEY varchar(3) NO COLUMN_KEY varchar(3) NO
EXTRA varchar(27) NO EXTRA varchar(27) NO
PRIVILEGES varchar(80) NO PRIVILEGES varchar(80) NO
COLUMN_COMMENT varchar(255) NO COLUMN_COMMENT varchar(1024) NO
SELECT table_catalog, table_schema, table_name, column_name SELECT table_catalog, table_schema, table_name, column_name
FROM information_schema.columns WHERE table_catalog IS NULL OR table_catalog <> 'def'; FROM information_schema.columns WHERE table_catalog IS NULL OR table_catalog <> 'def';
table_catalog table_schema table_name column_name table_catalog table_schema table_name column_name
......
...@@ -19,7 +19,7 @@ def information_schema COLUMNS CHARACTER_MAXIMUM_LENGTH 9 NULL YES bigint NULL N ...@@ -19,7 +19,7 @@ def information_schema COLUMNS CHARACTER_MAXIMUM_LENGTH 9 NULL YES bigint NULL N
def information_schema COLUMNS CHARACTER_OCTET_LENGTH 10 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select def information_schema COLUMNS CHARACTER_OCTET_LENGTH 10 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
def information_schema COLUMNS CHARACTER_SET_NAME 13 NULL YES varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select def information_schema COLUMNS CHARACTER_SET_NAME 13 NULL YES varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
def information_schema COLUMNS COLLATION_NAME 14 NULL YES varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select def information_schema COLUMNS COLLATION_NAME 14 NULL YES varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
def information_schema COLUMNS COLUMN_COMMENT 19 NO varchar 255 765 NULL NULL utf8 utf8_general_ci varchar(255) select def information_schema COLUMNS COLUMN_COMMENT 19 NO varchar 1024 3072 NULL NULL utf8 utf8_general_ci varchar(1024) select
def information_schema COLUMNS COLUMN_DEFAULT 6 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select def information_schema COLUMNS COLUMN_DEFAULT 6 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select
def information_schema COLUMNS COLUMN_KEY 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select def information_schema COLUMNS COLUMN_KEY 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select
def information_schema COLUMNS COLUMN_NAME 4 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema COLUMNS COLUMN_NAME 4 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
...@@ -242,6 +242,7 @@ def information_schema STATISTICS CARDINALITY 10 NULL YES bigint NULL NULL 19 0 ...@@ -242,6 +242,7 @@ def information_schema STATISTICS CARDINALITY 10 NULL YES bigint NULL NULL 19 0
def information_schema STATISTICS COLLATION 9 NULL YES varchar 1 3 NULL NULL utf8 utf8_general_ci varchar(1) select def information_schema STATISTICS COLLATION 9 NULL YES varchar 1 3 NULL NULL utf8 utf8_general_ci varchar(1) select
def information_schema STATISTICS COLUMN_NAME 8 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema STATISTICS COLUMN_NAME 8 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema STATISTICS COMMENT 15 NULL YES varchar 16 48 NULL NULL utf8 utf8_general_ci varchar(16) select def information_schema STATISTICS COMMENT 15 NULL YES varchar 16 48 NULL NULL utf8 utf8_general_ci varchar(16) select
def information_schema STATISTICS INDEX_COMMENT 16 NO varchar 1024 3072 NULL NULL utf8 utf8_general_ci varchar(1024) select
def information_schema STATISTICS INDEX_NAME 6 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema STATISTICS INDEX_NAME 6 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema STATISTICS INDEX_SCHEMA 5 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema STATISTICS INDEX_SCHEMA 5 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema STATISTICS INDEX_TYPE 14 NO varchar 16 48 NULL NULL utf8 utf8_general_ci varchar(16) select def information_schema STATISTICS INDEX_TYPE 14 NO varchar 16 48 NULL NULL utf8 utf8_general_ci varchar(16) select
...@@ -267,7 +268,7 @@ def information_schema TABLES MAX_DATA_LENGTH 11 NULL YES bigint NULL NULL 19 0 ...@@ -267,7 +268,7 @@ def information_schema TABLES MAX_DATA_LENGTH 11 NULL YES bigint NULL NULL 19 0
def information_schema TABLES ROW_FORMAT 7 NULL YES varchar 10 30 NULL NULL utf8 utf8_general_ci varchar(10) select def information_schema TABLES ROW_FORMAT 7 NULL YES varchar 10 30 NULL NULL utf8 utf8_general_ci varchar(10) select
def information_schema TABLES TABLE_CATALOG 1 NO varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select def information_schema TABLES TABLE_CATALOG 1 NO varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select
def information_schema TABLES TABLE_COLLATION 18 NULL YES varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select def information_schema TABLES TABLE_COLLATION 18 NULL YES varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
def information_schema TABLES TABLE_COMMENT 21 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select def information_schema TABLES TABLE_COMMENT 21 NO varchar 2048 6144 NULL NULL utf8 utf8_general_ci varchar(2048) select
def information_schema TABLES TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema TABLES TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema TABLES TABLE_ROWS 8 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select def information_schema TABLES TABLE_ROWS 8 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
def information_schema TABLES TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema TABLES TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
...@@ -419,7 +420,7 @@ NULL information_schema COLUMNS NUMERIC_SCALE bigint NULL NULL NULL NULL bigint( ...@@ -419,7 +420,7 @@ NULL information_schema COLUMNS NUMERIC_SCALE bigint NULL NULL NULL NULL bigint(
3.0000 information_schema COLUMNS COLUMN_KEY varchar 3 9 utf8 utf8_general_ci varchar(3) 3.0000 information_schema COLUMNS COLUMN_KEY varchar 3 9 utf8 utf8_general_ci varchar(3)
3.0000 information_schema COLUMNS EXTRA varchar 27 81 utf8 utf8_general_ci varchar(27) 3.0000 information_schema COLUMNS EXTRA varchar 27 81 utf8 utf8_general_ci varchar(27)
3.0000 information_schema COLUMNS PRIVILEGES varchar 80 240 utf8 utf8_general_ci varchar(80) 3.0000 information_schema COLUMNS PRIVILEGES varchar 80 240 utf8 utf8_general_ci varchar(80)
3.0000 information_schema COLUMNS COLUMN_COMMENT varchar 255 765 utf8 utf8_general_ci varchar(255) 3.0000 information_schema COLUMNS COLUMN_COMMENT varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema COLUMN_PRIVILEGES GRANTEE varchar 81 243 utf8 utf8_general_ci varchar(81) 3.0000 information_schema COLUMN_PRIVILEGES GRANTEE varchar 81 243 utf8 utf8_general_ci varchar(81)
3.0000 information_schema COLUMN_PRIVILEGES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) 3.0000 information_schema COLUMN_PRIVILEGES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512)
3.0000 information_schema COLUMN_PRIVILEGES TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema COLUMN_PRIVILEGES TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64)
...@@ -639,6 +640,7 @@ NULL information_schema STATISTICS SUB_PART bigint NULL NULL NULL NULL bigint(3) ...@@ -639,6 +640,7 @@ NULL information_schema STATISTICS SUB_PART bigint NULL NULL NULL NULL bigint(3)
3.0000 information_schema STATISTICS NULLABLE varchar 3 9 utf8 utf8_general_ci varchar(3) 3.0000 information_schema STATISTICS NULLABLE varchar 3 9 utf8 utf8_general_ci varchar(3)
3.0000 information_schema STATISTICS INDEX_TYPE varchar 16 48 utf8 utf8_general_ci varchar(16) 3.0000 information_schema STATISTICS INDEX_TYPE varchar 16 48 utf8 utf8_general_ci varchar(16)
3.0000 information_schema STATISTICS COMMENT varchar 16 48 utf8 utf8_general_ci varchar(16) 3.0000 information_schema STATISTICS COMMENT varchar 16 48 utf8 utf8_general_ci varchar(16)
3.0000 information_schema STATISTICS INDEX_COMMENT varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema TABLES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) 3.0000 information_schema TABLES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512)
3.0000 information_schema TABLES TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema TABLES TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema TABLES TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema TABLES TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
...@@ -659,7 +661,7 @@ NULL information_schema TABLES CHECK_TIME datetime NULL NULL NULL NULL datetime ...@@ -659,7 +661,7 @@ NULL information_schema TABLES CHECK_TIME datetime NULL NULL NULL NULL datetime
3.0000 information_schema TABLES TABLE_COLLATION varchar 32 96 utf8 utf8_general_ci varchar(32) 3.0000 information_schema TABLES TABLE_COLLATION varchar 32 96 utf8 utf8_general_ci varchar(32)
NULL information_schema TABLES CHECKSUM bigint NULL NULL NULL NULL bigint(21) unsigned NULL information_schema TABLES CHECKSUM bigint NULL NULL NULL NULL bigint(21) unsigned
3.0000 information_schema TABLES CREATE_OPTIONS varchar 255 765 utf8 utf8_general_ci varchar(255) 3.0000 information_schema TABLES CREATE_OPTIONS varchar 255 765 utf8 utf8_general_ci varchar(255)
3.0000 information_schema TABLES TABLE_COMMENT varchar 80 240 utf8 utf8_general_ci varchar(80) 3.0000 information_schema TABLES TABLE_COMMENT varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema TABLESPACES TABLESPACE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema TABLESPACES TABLESPACE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema TABLESPACES ENGINE varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema TABLESPACES ENGINE varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema TABLESPACES TABLESPACE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema TABLESPACES TABLESPACE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64)
......
...@@ -43,6 +43,7 @@ PACKED varchar(10) YES NULL ...@@ -43,6 +43,7 @@ PACKED varchar(10) YES NULL
NULLABLE varchar(3) NO NULLABLE varchar(3) NO
INDEX_TYPE varchar(16) NO INDEX_TYPE varchar(16) NO
COMMENT varchar(16) YES NULL COMMENT varchar(16) YES NULL
INDEX_COMMENT varchar(1024) NO
SHOW CREATE TABLE information_schema.STATISTICS; SHOW CREATE TABLE information_schema.STATISTICS;
Table Create Table Table Create Table
STATISTICS CREATE TEMPORARY TABLE `STATISTICS` ( STATISTICS CREATE TEMPORARY TABLE `STATISTICS` (
...@@ -60,7 +61,8 @@ STATISTICS CREATE TEMPORARY TABLE `STATISTICS` ( ...@@ -60,7 +61,8 @@ STATISTICS CREATE TEMPORARY TABLE `STATISTICS` (
`PACKED` varchar(10) DEFAULT NULL, `PACKED` varchar(10) DEFAULT NULL,
`NULLABLE` varchar(3) NOT NULL DEFAULT '', `NULLABLE` varchar(3) NOT NULL DEFAULT '',
`INDEX_TYPE` varchar(16) NOT NULL DEFAULT '', `INDEX_TYPE` varchar(16) NOT NULL DEFAULT '',
`COMMENT` varchar(16) DEFAULT NULL `COMMENT` varchar(16) DEFAULT NULL,
`INDEX_COMMENT` varchar(1024) NOT NULL DEFAULT ''
) ENGINE=MEMORY DEFAULT CHARSET=utf8 ) ENGINE=MEMORY DEFAULT CHARSET=utf8
SHOW COLUMNS FROM information_schema.STATISTICS; SHOW COLUMNS FROM information_schema.STATISTICS;
Field Type Null Key Default Extra Field Type Null Key Default Extra
...@@ -79,6 +81,7 @@ PACKED varchar(10) YES NULL ...@@ -79,6 +81,7 @@ PACKED varchar(10) YES NULL
NULLABLE varchar(3) NO NULLABLE varchar(3) NO
INDEX_TYPE varchar(16) NO INDEX_TYPE varchar(16) NO
COMMENT varchar(16) YES NULL COMMENT varchar(16) YES NULL
INDEX_COMMENT varchar(1024) NO
SELECT table_catalog, table_schema, table_name, index_schema, index_name SELECT table_catalog, table_schema, table_name, index_schema, index_name
FROM information_schema.statistics WHERE table_catalog IS NOT NULL; FROM information_schema.statistics WHERE table_catalog IS NOT NULL;
table_catalog table_schema table_name index_schema index_name table_catalog table_schema table_name index_schema index_name
...@@ -157,7 +160,7 @@ ENGINE = MEMORY; ...@@ -157,7 +160,7 @@ ENGINE = MEMORY;
SELECT * FROM information_schema.statistics SELECT * FROM information_schema.statistics
WHERE table_schema LIKE 'db_datadict%' WHERE table_schema LIKE 'db_datadict%'
ORDER BY table_schema,table_name,index_name,seq_in_index,column_name; ORDER BY table_schema,table_name,index_name,seq_in_index,column_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
def db_datadict t1 1 db_datadict f2_ind 1 f2 NULL 0 NULL NULL YES HASH def db_datadict t1 1 db_datadict f2_ind 1 f2 NULL 0 NULL NULL YES HASH
def db_datadict t1 0 db_datadict PRIMARY 1 f1 NULL 0 NULL NULL HASH def db_datadict t1 0 db_datadict PRIMARY 1 f1 NULL 0 NULL NULL HASH
def db_datadict t2 1 db_datadict f2_ind 1 f2 NULL 0 NULL NULL YES HASH def db_datadict t2 1 db_datadict f2_ind 1 f2 NULL 0 NULL NULL YES HASH
...@@ -178,7 +181,7 @@ GRANT USAGE ON *.* TO 'testuser2'@'localhost' ...@@ -178,7 +181,7 @@ GRANT USAGE ON *.* TO 'testuser2'@'localhost'
SELECT * FROM information_schema.statistics SELECT * FROM information_schema.statistics
WHERE table_schema LIKE 'db_datadict%' WHERE table_schema LIKE 'db_datadict%'
ORDER BY table_schema,table_name,index_name,seq_in_index,column_name; ORDER BY table_schema,table_name,index_name,seq_in_index,column_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
SHOW GRANTS FOR 'testuser1'@'localhost'; SHOW GRANTS FOR 'testuser1'@'localhost';
Grants for testuser1@localhost Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost' GRANT USAGE ON *.* TO 'testuser1'@'localhost'
...@@ -188,7 +191,7 @@ ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'mysql' ...@@ -188,7 +191,7 @@ ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'mysql'
SELECT * FROM information_schema.statistics SELECT * FROM information_schema.statistics
WHERE table_schema LIKE 'db_datadict%' WHERE table_schema LIKE 'db_datadict%'
ORDER BY table_schema,table_name,index_name,seq_in_index,column_name; ORDER BY table_schema,table_name,index_name,seq_in_index,column_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
SHOW GRANTS FOR 'testuser1'@'localhost'; SHOW GRANTS FOR 'testuser1'@'localhost';
ERROR 42000: Access denied for user 'testuser2'@'localhost' to database 'mysql' ERROR 42000: Access denied for user 'testuser2'@'localhost' to database 'mysql'
SHOW GRANTS FOR 'testuser2'@'localhost'; SHOW GRANTS FOR 'testuser2'@'localhost';
...@@ -200,7 +203,7 @@ GRANT SELECT(f1,f5) ON db_datadict_2.t3 TO 'testuser1'@'localhost'; ...@@ -200,7 +203,7 @@ GRANT SELECT(f1,f5) ON db_datadict_2.t3 TO 'testuser1'@'localhost';
SELECT * FROM information_schema.statistics SELECT * FROM information_schema.statistics
WHERE table_schema LIKE 'db_datadict%' WHERE table_schema LIKE 'db_datadict%'
ORDER BY table_schema,table_name,index_name,seq_in_index,column_name; ORDER BY table_schema,table_name,index_name,seq_in_index,column_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
def db_datadict t1 1 db_datadict f2_ind 1 f2 NULL 0 NULL NULL YES HASH def db_datadict t1 1 db_datadict f2_ind 1 f2 NULL 0 NULL NULL YES HASH
def db_datadict t1 0 db_datadict PRIMARY 1 f1 NULL 0 NULL NULL HASH def db_datadict t1 0 db_datadict PRIMARY 1 f1 NULL 0 NULL NULL HASH
def db_datadict t2 1 db_datadict f2_ind 1 f2 NULL 0 NULL NULL YES HASH def db_datadict t2 1 db_datadict f2_ind 1 f2 NULL 0 NULL NULL YES HASH
...@@ -223,7 +226,7 @@ GRANT USAGE ON *.* TO 'testuser2'@'localhost' ...@@ -223,7 +226,7 @@ GRANT USAGE ON *.* TO 'testuser2'@'localhost'
SELECT * FROM information_schema.statistics SELECT * FROM information_schema.statistics
WHERE table_schema LIKE 'db_datadict%' WHERE table_schema LIKE 'db_datadict%'
ORDER BY table_schema,table_name,index_name,seq_in_index,column_name; ORDER BY table_schema,table_name,index_name,seq_in_index,column_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
def db_datadict t1 1 db_datadict f2_ind 1 f2 NULL 0 NULL NULL YES HASH def db_datadict t1 1 db_datadict f2_ind 1 f2 NULL 0 NULL NULL YES HASH
def db_datadict t1 0 db_datadict PRIMARY 1 f1 NULL 0 NULL NULL HASH def db_datadict t1 0 db_datadict PRIMARY 1 f1 NULL 0 NULL NULL HASH
def db_datadict_2 t3 1 db_datadict_2 f2f1_ind 1 f2 NULL NULL NULL NULL YES HASH def db_datadict_2 t3 1 db_datadict_2 f2f1_ind 1 f2 NULL NULL NULL NULL YES HASH
...@@ -241,7 +244,7 @@ ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'mysql' ...@@ -241,7 +244,7 @@ ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'mysql'
SELECT * FROM information_schema.statistics SELECT * FROM information_schema.statistics
WHERE table_schema LIKE 'db_datadict%' WHERE table_schema LIKE 'db_datadict%'
ORDER BY table_schema,table_name,index_name,seq_in_index,column_name; ORDER BY table_schema,table_name,index_name,seq_in_index,column_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
SHOW GRANTS FOR 'testuser1'@'localhost'; SHOW GRANTS FOR 'testuser1'@'localhost';
ERROR 42000: Access denied for user 'testuser2'@'localhost' to database 'mysql' ERROR 42000: Access denied for user 'testuser2'@'localhost' to database 'mysql'
SHOW GRANTS FOR 'testuser2'@'localhost'; SHOW GRANTS FOR 'testuser2'@'localhost';
...@@ -257,7 +260,7 @@ GRANT SELECT (f5, f1) ON `db_datadict_2`.`t3` TO 'testuser1'@'localhost' ...@@ -257,7 +260,7 @@ GRANT SELECT (f5, f1) ON `db_datadict_2`.`t3` TO 'testuser1'@'localhost'
SELECT * FROM information_schema.statistics SELECT * FROM information_schema.statistics
WHERE table_schema LIKE 'db_datadict%' WHERE table_schema LIKE 'db_datadict%'
ORDER BY table_schema,table_name,index_name,seq_in_index,column_name; ORDER BY table_schema,table_name,index_name,seq_in_index,column_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
def db_datadict_2 t3 1 db_datadict_2 f2f1_ind 1 f2 NULL NULL NULL NULL YES HASH def db_datadict_2 t3 1 db_datadict_2 f2f1_ind 1 f2 NULL NULL NULL NULL YES HASH
def db_datadict_2 t3 1 db_datadict_2 f2f1_ind 2 f1 NULL 0 NULL NULL HASH def db_datadict_2 t3 1 db_datadict_2 f2f1_ind 2 f1 NULL 0 NULL NULL HASH
def db_datadict_2 t3 0 db_datadict_2 f5 1 f5 NULL 0 NULL NULL YES HASH def db_datadict_2 t3 0 db_datadict_2 f5 1 f5 NULL 0 NULL NULL YES HASH
...@@ -291,7 +294,7 @@ ALTER TABLE test.t1_1 ADD PRIMARY KEY (f1,f3); ...@@ -291,7 +294,7 @@ ALTER TABLE test.t1_1 ADD PRIMARY KEY (f1,f3);
SELECT * FROM information_schema.statistics SELECT * FROM information_schema.statistics
WHERE table_name LIKE 't1_%' WHERE table_name LIKE 't1_%'
ORDER BY table_schema,table_name,index_name,seq_in_index,column_name; ORDER BY table_schema,table_name,index_name,seq_in_index,column_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
def test t1_1 0 test PRIMARY 1 f1 A NULL NULL NULL BTREE def test t1_1 0 test PRIMARY 1 f1 A NULL NULL NULL BTREE
def test t1_1 0 test PRIMARY 2 f3 A 0 NULL NULL BTREE def test t1_1 0 test PRIMARY 2 f3 A 0 NULL NULL BTREE
ALTER TABLE test.t1_1 DROP PRIMARY KEY; ALTER TABLE test.t1_1 DROP PRIMARY KEY;
...@@ -301,20 +304,20 @@ table_name ...@@ -301,20 +304,20 @@ table_name
ALTER TABLE test.t1_1 ADD PRIMARY KEY (f1); ALTER TABLE test.t1_1 ADD PRIMARY KEY (f1);
SELECT * FROM information_schema.statistics SELECT * FROM information_schema.statistics
WHERE table_name LIKE 't1_%'; WHERE table_name LIKE 't1_%';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
def test t1_1 0 test PRIMARY 1 f1 A 0 NULL NULL BTREE def test t1_1 0 test PRIMARY 1 f1 A 0 NULL NULL BTREE
ALTER TABLE test.t1_1 ADD INDEX (f4); ALTER TABLE test.t1_1 ADD INDEX (f4);
CREATE INDEX f3_f1 ON test.t1_1 (f3,f1); CREATE INDEX f3_f1 ON test.t1_1 (f3,f1);
CREATE UNIQUE INDEX f4x_uni ON test.t1_1 (f4x); CREATE UNIQUE INDEX f4x_uni ON test.t1_1 (f4x);
CREATE INDEX f2_hash USING HASH ON test.t1_2 (f2); CREATE INDEX f2_hash USING HASH ON test.t1_2 (f2);
CREATE INDEX f1_idx ON test.t1_2 (f1) COMMENT = 'COMMENT'; CREATE INDEX f1_idx ON test.t1_2 (f1) COMMENT = 'COMMENT';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COMMENT = 'COMMENT'' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= 'COMMENT'' at line 1
CREATE INDEX not_null ON test.t1_1 (f3x); CREATE INDEX not_null ON test.t1_1 (f3x);
CREATE INDEX f2_prefix ON test.t1_1 (f2(20)); CREATE INDEX f2_prefix ON test.t1_1 (f2(20));
SELECT * FROM information_schema.statistics SELECT * FROM information_schema.statistics
WHERE table_name LIKE 't1_%' AND index_name <> 'PRIMARY' WHERE table_name LIKE 't1_%' AND index_name <> 'PRIMARY'
ORDER BY table_schema,table_name,index_name,seq_in_index,column_name; ORDER BY table_schema,table_name,index_name,seq_in_index,column_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
def test t1_1 1 test f2_prefix 1 f2 A NULL 20 NULL YES BTREE def test t1_1 1 test f2_prefix 1 f2 A NULL 20 NULL YES BTREE
def test t1_1 1 test f3_f1 1 f3 A NULL NULL NULL BTREE def test t1_1 1 test f3_f1 1 f3 A NULL NULL NULL BTREE
def test t1_1 1 test f3_f1 2 f1 A NULL NULL NULL BTREE def test t1_1 1 test f3_f1 2 f1 A NULL NULL NULL BTREE
......
...@@ -6,12 +6,12 @@ GRANT SELECT ON db_datadict.* TO testuser1@localhost; ...@@ -6,12 +6,12 @@ GRANT SELECT ON db_datadict.* TO testuser1@localhost;
SELECT * FROM information_schema.statistics SELECT * FROM information_schema.statistics
WHERE table_schema = 'information_schema' WHERE table_schema = 'information_schema'
ORDER BY table_schema, table_name, index_name, seq_in_index, column_name; ORDER BY table_schema, table_name, index_name, seq_in_index, column_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
# Establish connection testuser1 (user=testuser1) # Establish connection testuser1 (user=testuser1)
SELECT * FROM information_schema.statistics SELECT * FROM information_schema.statistics
WHERE table_schema = 'information_schema' WHERE table_schema = 'information_schema'
ORDER BY table_schema, table_name, index_name, seq_in_index, column_name; ORDER BY table_schema, table_name, index_name, seq_in_index, column_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
# Switch to connection default and close connection testuser1 # Switch to connection default and close connection testuser1
DROP USER testuser1@localhost; DROP USER testuser1@localhost;
DROP DATABASE db_datadict; DROP DATABASE db_datadict;
...@@ -6,7 +6,7 @@ GRANT SELECT ON db_datadict.* TO testuser1@localhost; ...@@ -6,7 +6,7 @@ GRANT SELECT ON db_datadict.* TO testuser1@localhost;
SELECT * FROM information_schema.statistics SELECT * FROM information_schema.statistics
WHERE table_schema = 'mysql' WHERE table_schema = 'mysql'
ORDER BY table_schema, table_name, index_name, seq_in_index, column_name; ORDER BY table_schema, table_name, index_name, seq_in_index, column_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
def mysql columns_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE def mysql columns_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
def mysql columns_priv 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE def mysql columns_priv 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE
def mysql columns_priv 0 mysql PRIMARY 3 User A #CARD# NULL NULL BTREE def mysql columns_priv 0 mysql PRIMARY 3 User A #CARD# NULL NULL BTREE
...@@ -59,7 +59,7 @@ def mysql user 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE ...@@ -59,7 +59,7 @@ def mysql user 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE
SELECT * FROM information_schema.statistics SELECT * FROM information_schema.statistics
WHERE table_schema = 'mysql' WHERE table_schema = 'mysql'
ORDER BY table_schema, table_name, index_name, seq_in_index, column_name; ORDER BY table_schema, table_name, index_name, seq_in_index, column_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
# Switch to connection default and close connection testuser1 # Switch to connection default and close connection testuser1
DROP USER testuser1@localhost; DROP USER testuser1@localhost;
DROP DATABASE db_datadict; DROP DATABASE db_datadict;
...@@ -110,14 +110,14 @@ def db_datadict my_idx2 db_datadict t1 UNIQUE ...@@ -110,14 +110,14 @@ def db_datadict my_idx2 db_datadict t1 UNIQUE
def db_datadict PRIMARY db_datadict t1 PRIMARY KEY def db_datadict PRIMARY db_datadict t1 PRIMARY KEY
def db_datadict PRIMARY db_datadict t2 PRIMARY KEY def db_datadict PRIMARY db_datadict t2 PRIMARY KEY
SHOW INDEXES FROM db_datadict.t1; SHOW INDEXES FROM db_datadict.t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 f1 ### ### ### ### ### ### ### t1 0 PRIMARY 1 f1 ### ### ### ### ### ### ###
t1 0 PRIMARY 2 f2 ### ### ### ### ### ### ### t1 0 PRIMARY 2 f2 ### ### ### ### ### ### ###
t1 0 my_idx1 1 f6 ### ### ### ### ### ### ### t1 0 my_idx1 1 f6 ### ### ### ### ### ### ###
t1 0 my_idx1 2 f1 ### ### ### ### ### ### ### t1 0 my_idx1 2 f1 ### ### ### ### ### ### ###
t1 0 my_idx2 1 f3 ### ### ### ### ### ### ### t1 0 my_idx2 1 f3 ### ### ### ### ### ### ###
SHOW INDEXES FROM db_datadict.t2; SHOW INDEXES FROM db_datadict.t2;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t2 0 PRIMARY 1 f1 ### ### ### ### ### ### ### t2 0 PRIMARY 1 f1 ### ### ### ### ### ### ###
t2 0 PRIMARY 2 f2 ### ### ### ### ### ### ### t2 0 PRIMARY 2 f2 ### ### ### ### ### ### ###
# Establish connection testuser1 (user=testuser1) # Establish connection testuser1 (user=testuser1)
...@@ -133,7 +133,7 @@ def db_datadict my_idx1 db_datadict t1 UNIQUE ...@@ -133,7 +133,7 @@ def db_datadict my_idx1 db_datadict t1 UNIQUE
def db_datadict my_idx2 db_datadict t1 UNIQUE def db_datadict my_idx2 db_datadict t1 UNIQUE
def db_datadict PRIMARY db_datadict t1 PRIMARY KEY def db_datadict PRIMARY db_datadict t1 PRIMARY KEY
SHOW INDEXES FROM db_datadict.t1; SHOW INDEXES FROM db_datadict.t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 f1 ### ### ### ### ### ### ### t1 0 PRIMARY 1 f1 ### ### ### ### ### ### ###
t1 0 PRIMARY 2 f2 ### ### ### ### ### ### ### t1 0 PRIMARY 2 f2 ### ### ### ### ### ### ###
t1 0 my_idx1 1 f6 ### ### ### ### ### ### ### t1 0 my_idx1 1 f6 ### ### ### ### ### ### ###
......
...@@ -48,7 +48,7 @@ CHECK_TIME datetime YES NULL ...@@ -48,7 +48,7 @@ CHECK_TIME datetime YES NULL
TABLE_COLLATION varchar(32) YES NULL TABLE_COLLATION varchar(32) YES NULL
CHECKSUM bigint(21) unsigned YES NULL CHECKSUM bigint(21) unsigned YES NULL
CREATE_OPTIONS varchar(255) YES NULL CREATE_OPTIONS varchar(255) YES NULL
TABLE_COMMENT varchar(80) NO TABLE_COMMENT varchar(2048) NO
SHOW CREATE TABLE information_schema.TABLES; SHOW CREATE TABLE information_schema.TABLES;
Table Create Table Table Create Table
TABLES CREATE TEMPORARY TABLE `TABLES` ( TABLES CREATE TEMPORARY TABLE `TABLES` (
...@@ -72,7 +72,7 @@ TABLES CREATE TEMPORARY TABLE `TABLES` ( ...@@ -72,7 +72,7 @@ TABLES CREATE TEMPORARY TABLE `TABLES` (
`TABLE_COLLATION` varchar(32) DEFAULT NULL, `TABLE_COLLATION` varchar(32) DEFAULT NULL,
`CHECKSUM` bigint(21) unsigned DEFAULT NULL, `CHECKSUM` bigint(21) unsigned DEFAULT NULL,
`CREATE_OPTIONS` varchar(255) DEFAULT NULL, `CREATE_OPTIONS` varchar(255) DEFAULT NULL,
`TABLE_COMMENT` varchar(80) NOT NULL DEFAULT '' `TABLE_COMMENT` varchar(2048) NOT NULL DEFAULT ''
) ENGINE=MEMORY DEFAULT CHARSET=utf8 ) ENGINE=MEMORY DEFAULT CHARSET=utf8
SHOW COLUMNS FROM information_schema.TABLES; SHOW COLUMNS FROM information_schema.TABLES;
Field Type Null Key Default Extra Field Type Null Key Default Extra
...@@ -96,7 +96,7 @@ CHECK_TIME datetime YES NULL ...@@ -96,7 +96,7 @@ CHECK_TIME datetime YES NULL
TABLE_COLLATION varchar(32) YES NULL TABLE_COLLATION varchar(32) YES NULL
CHECKSUM bigint(21) unsigned YES NULL CHECKSUM bigint(21) unsigned YES NULL
CREATE_OPTIONS varchar(255) YES NULL CREATE_OPTIONS varchar(255) YES NULL
TABLE_COMMENT varchar(80) NO TABLE_COMMENT varchar(2048) NO
SELECT table_catalog, table_schema, table_name SELECT table_catalog, table_schema, table_name
FROM information_schema.tables WHERE table_catalog IS NULL OR table_catalog <> 'def'; FROM information_schema.tables WHERE table_catalog IS NULL OR table_catalog <> 'def';
table_catalog table_schema table_name table_catalog table_schema table_name
......
...@@ -4,7 +4,7 @@ engine=ndb; ...@@ -4,7 +4,7 @@ engine=ndb;
insert into t1 values (1,'one','one'), (2,'two','two'), (3,'three','three'); insert into t1 values (1,'one','one'), (2,'two','two'), (3,'three','three');
create index c on t1(c); create index c on t1(c);
show indexes from t1; show indexes from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 a A 3 NULL NULL BTREE t1 0 PRIMARY 1 a A 3 NULL NULL BTREE
t1 1 b 1 b A 3 NULL NULL YES BTREE t1 1 b 1 b A 3 NULL NULL YES BTREE
t1 1 c 1 c A 3 NULL NULL YES BTREE t1 1 c 1 c A 3 NULL NULL YES BTREE
...@@ -13,7 +13,7 @@ a b c ...@@ -13,7 +13,7 @@ a b c
2 two two 2 two two
alter table t1 drop index c; alter table t1 drop index c;
show indexes from t1; show indexes from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 a A 3 NULL NULL BTREE t1 0 PRIMARY 1 a A 3 NULL NULL BTREE
t1 1 b 1 b A 3 NULL NULL YES BTREE t1 1 b 1 b A 3 NULL NULL YES BTREE
select * from t1 where c = 'two'; select * from t1 where c = 'two';
......
...@@ -39,11 +39,11 @@ attr2 INT, ...@@ -39,11 +39,11 @@ attr2 INT,
attr3 VARCHAR(10) attr3 VARCHAR(10)
) ENGINE=ndbcluster; ) ENGINE=ndbcluster;
SHOW INDEX FROM t1; SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 pk1 A 0 NULL NULL BTREE t1 0 PRIMARY 1 pk1 A 0 NULL NULL BTREE
INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413'); INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413');
SHOW INDEX FROM t1; SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 pk1 A 2 NULL NULL BTREE t1 0 PRIMARY 1 pk1 A 2 NULL NULL BTREE
SELECT pk1 FROM t1 ORDER BY pk1; SELECT pk1 FROM t1 ORDER BY pk1;
pk1 pk1
......
...@@ -878,11 +878,11 @@ TEST-INFO: SLAVE: The INSERT is committed (Succeeded) ...@@ -878,11 +878,11 @@ TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master ------- -------- switch to master -------
SHOW INDEX FROM mysqltest1.t6; SHOW INDEX FROM mysqltest1.t6;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
-------- switch to slave -------- -------- switch to slave --------
SHOW INDEX FROM mysqltest1.t6; SHOW INDEX FROM mysqltest1.t6;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
-------- switch to master ------- -------- switch to master -------
...@@ -927,12 +927,12 @@ TEST-INFO: SLAVE: The INSERT is committed (Succeeded) ...@@ -927,12 +927,12 @@ TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master ------- -------- switch to master -------
SHOW INDEX FROM mysqltest1.t5; SHOW INDEX FROM mysqltest1.t5;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t5 1 my_idx5 1 f1 A 0 NULL NULL YES BTREE t5 1 my_idx5 1 f1 A 0 NULL NULL YES BTREE
-------- switch to slave -------- -------- switch to slave --------
SHOW INDEX FROM mysqltest1.t5; SHOW INDEX FROM mysqltest1.t5;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t5 1 my_idx5 1 f1 A 0 NULL NULL YES BTREE t5 1 my_idx5 1 f1 A 0 NULL NULL YES BTREE
-------- switch to master ------- -------- switch to master -------
......
...@@ -21,7 +21,7 @@ ANALYZE TABLE t1; ...@@ -21,7 +21,7 @@ ANALYZE TABLE t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze status OK test.t1 analyze status OK
SHOW INDEX FROM t1; SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A 10 NULL NULL YES BTREE t1 1 a 1 a A 10 NULL NULL YES BTREE
INSERT INTO t1 VALUES (11); INSERT INTO t1 VALUES (11);
DELETE FROM t1 WHERE a = 11; DELETE FROM t1 WHERE a = 11;
...@@ -29,7 +29,7 @@ CHECK TABLE t1; ...@@ -29,7 +29,7 @@ CHECK TABLE t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
SHOW INDEX FROM t1; SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A 10 NULL NULL YES BTREE t1 1 a 1 a A 10 NULL NULL YES BTREE
'Set nulls to be equal' 'Set nulls to be equal'
SET myisam_stats_method = nulls_equal; SET myisam_stats_method = nulls_equal;
...@@ -39,7 +39,7 @@ ANALYZE TABLE t1; ...@@ -39,7 +39,7 @@ ANALYZE TABLE t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze status OK test.t1 analyze status OK
SHOW INDEX FROM t1; SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A 5 NULL NULL YES BTREE t1 1 a 1 a A 5 NULL NULL YES BTREE
INSERT INTO t1 VALUES (11); INSERT INTO t1 VALUES (11);
DELETE FROM t1 WHERE a = 11; DELETE FROM t1 WHERE a = 11;
...@@ -47,7 +47,7 @@ CHECK TABLE t1; ...@@ -47,7 +47,7 @@ CHECK TABLE t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
SHOW INDEX FROM t1; SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A 5 NULL NULL YES BTREE t1 1 a 1 a A 5 NULL NULL YES BTREE
'Set nulls to be ignored' 'Set nulls to be ignored'
SET myisam_stats_method = nulls_ignored; SET myisam_stats_method = nulls_ignored;
...@@ -67,7 +67,7 @@ ANALYZE TABLE t1; ...@@ -67,7 +67,7 @@ ANALYZE TABLE t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze status OK test.t1 analyze status OK
SHOW INDEX FROM t1; SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A 2 NULL NULL YES BTREE t1 1 a 1 a A 2 NULL NULL YES BTREE
t1 1 a 2 b A 4 NULL NULL YES BTREE t1 1 a 2 b A 4 NULL NULL YES BTREE
t1 1 a 3 c A 4 NULL NULL YES BTREE t1 1 a 3 c A 4 NULL NULL YES BTREE
...@@ -77,7 +77,7 @@ ANALYZE TABLE t1; ...@@ -77,7 +77,7 @@ ANALYZE TABLE t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze status OK test.t1 analyze status OK
SHOW INDEX FROM t1; SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A 0 NULL NULL YES BTREE t1 1 a 1 a A 0 NULL NULL YES BTREE
t1 1 a 2 b A 0 NULL NULL YES BTREE t1 1 a 2 b A 0 NULL NULL YES BTREE
t1 1 a 3 c A 0 NULL NULL YES BTREE t1 1 a 3 c A 0 NULL NULL YES BTREE
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
...@@ -1166,11 +1166,65 @@ set @@sql_mode='traditional'; ...@@ -1166,11 +1166,65 @@ set @@sql_mode='traditional';
--error ER_TOO_LONG_TABLE_COMMENT --error ER_TOO_LONG_TABLE_COMMENT
create table t1 (i int) create table t1 (i int)
comment '123456789*123456789*123456789*123456789*123456789* comment '123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*123456789*'; 123456789*123456789*123456789*123456789*123456789*';
--error ER_TOO_LONG_FIELD_COMMENT --error ER_TOO_LONG_FIELD_COMMENT
create table t1 ( create table t1 (
i int comment i int comment
'123456789*123456789*123456789*123456789* '123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789* 123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789* 123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789* 123456789*123456789*123456789*123456789*
...@@ -1181,6 +1235,26 @@ set @@sql_mode= @org_mode; ...@@ -1181,6 +1235,26 @@ set @@sql_mode= @org_mode;
create table t1 create table t1
(i int comment (i int comment
'123456789*123456789*123456789*123456789* '123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789* 123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789* 123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789* 123456789*123456789*123456789*123456789*
......
...@@ -1011,6 +1011,7 @@ typedef struct st_key_create_information ...@@ -1011,6 +1011,7 @@ typedef struct st_key_create_information
enum ha_key_alg algorithm; enum ha_key_alg algorithm;
ulong block_size; ulong block_size;
LEX_STRING parser_name; LEX_STRING parser_name;
LEX_STRING comment;
} KEY_CREATE_INFO; } KEY_CREATE_INFO;
......
...@@ -2317,7 +2317,7 @@ ulong next_io_size(ulong pos); ...@@ -2317,7 +2317,7 @@ ulong next_io_size(ulong pos);
void append_unescaped(String *res, const char *pos, uint length); void append_unescaped(String *res, const char *pos, uint length);
int create_frm(THD *thd, const char *name, const char *db, const char *table, int create_frm(THD *thd, const char *name, const char *db, const char *table,
uint reclength, uchar *fileinfo, uint reclength, uchar *fileinfo,
HA_CREATE_INFO *create_info, uint keys); HA_CREATE_INFO *create_info, uint keys, KEY *key_info);
void update_create_info_from_table(HA_CREATE_INFO *info, TABLE *form); void update_create_info_from_table(HA_CREATE_INFO *info, TABLE *form);
int rename_file_ext(const char * from,const char * to,const char * ext); int rename_file_ext(const char * from,const char * to,const char * ext);
bool check_db_name(LEX_STRING *db); bool check_db_name(LEX_STRING *db);
...@@ -2327,6 +2327,7 @@ char *get_field(MEM_ROOT *mem, Field *field); ...@@ -2327,6 +2327,7 @@ char *get_field(MEM_ROOT *mem, Field *field);
bool get_field(MEM_ROOT *mem, Field *field, class String *res); bool get_field(MEM_ROOT *mem, Field *field, class String *res);
int wild_case_compare(CHARSET_INFO *cs, const char *str,const char *wildstr); int wild_case_compare(CHARSET_INFO *cs, const char *str,const char *wildstr);
char *fn_rext(char *name); char *fn_rext(char *name);
bool check_duplicate_warning(THD *thd, char *msg, ulong length);
/* Conversion functions */ /* Conversion functions */
#endif /* MYSQL_SERVER */ #endif /* MYSQL_SERVER */
......
...@@ -6321,3 +6321,5 @@ ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_DIRECT ...@@ -6321,3 +6321,5 @@ ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_DIRECT
ER_SPATIAL_MUST_HAVE_GEOM_COL 42000 ER_SPATIAL_MUST_HAVE_GEOM_COL 42000
eng "A SPATIAL index may only contain a geometrical type column" eng "A SPATIAL index may only contain a geometrical type column"
ER_TOO_LONG_INDEX_COMMENT
eng "Comment for index '%-.64s' is too long (max = %lu)"
...@@ -1376,7 +1376,6 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, ...@@ -1376,7 +1376,6 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
packet->append(buff, (uint) (end - buff)); packet->append(buff, (uint) (end - buff));
} }
if (share->table_charset && if (share->table_charset &&
!(thd->variables.sql_mode & MODE_MYSQL323) && !(thd->variables.sql_mode & MODE_MYSQL323) &&
!(thd->variables.sql_mode & MODE_MYSQL40)) !(thd->variables.sql_mode & MODE_MYSQL40))
...@@ -1520,6 +1519,14 @@ static void store_key_options(THD *thd, String *packet, TABLE *table, ...@@ -1520,6 +1519,14 @@ static void store_key_options(THD *thd, String *packet, TABLE *table,
end= longlong10_to_str(key_info->block_size, buff, 10); end= longlong10_to_str(key_info->block_size, buff, 10);
packet->append(buff, (uint) (end - buff)); packet->append(buff, (uint) (end - buff));
} }
DBUG_ASSERT(test(key_info->flags & HA_USES_COMMENT) ==
(key_info->comment.length > 0));
if (key_info->flags & HA_USES_COMMENT)
{
packet->append(STRING_WITH_LEN(" COMMENT "));
append_unescaped(packet, key_info->comment.str,
key_info->comment.length);
}
} }
} }
...@@ -4767,6 +4774,11 @@ static int get_schema_stat_record(THD *thd, TABLE_LIST *tables, ...@@ -4767,6 +4774,11 @@ static int get_schema_stat_record(THD *thd, TABLE_LIST *tables,
else else
table->field[14]->store("", 0, cs); table->field[14]->store("", 0, cs);
table->field[14]->set_notnull(); table->field[14]->set_notnull();
DBUG_ASSERT(test(key_info->flags & HA_USES_COMMENT) ==
(key_info->comment.length > 0));
if (key_info->flags & HA_USES_COMMENT)
table->field[15]->store(key_info->comment.str,
key_info->comment.length, cs);
if (schema_table_store_record(thd, table)) if (schema_table_store_record(thd, table))
DBUG_RETURN(1); DBUG_RETURN(1);
} }
...@@ -6725,7 +6737,8 @@ ST_FIELD_INFO tables_fields_info[]= ...@@ -6725,7 +6737,8 @@ ST_FIELD_INFO tables_fields_info[]=
(MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Checksum", OPEN_FULL_TABLE}, (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Checksum", OPEN_FULL_TABLE},
{"CREATE_OPTIONS", 255, MYSQL_TYPE_STRING, 0, 1, "Create_options", {"CREATE_OPTIONS", 255, MYSQL_TYPE_STRING, 0, 1, "Create_options",
OPEN_FRM_ONLY}, OPEN_FRM_ONLY},
{"TABLE_COMMENT", 80, MYSQL_TYPE_STRING, 0, 0, "Comment", OPEN_FRM_ONLY}, {"TABLE_COMMENT", TABLE_COMMENT_MAXLEN, MYSQL_TYPE_STRING, 0, 0,
"Comment", OPEN_FRM_ONLY},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
}; };
...@@ -6759,7 +6772,8 @@ ST_FIELD_INFO columns_fields_info[]= ...@@ -6759,7 +6772,8 @@ ST_FIELD_INFO columns_fields_info[]=
{"COLUMN_KEY", 3, MYSQL_TYPE_STRING, 0, 0, "Key", OPEN_FRM_ONLY}, {"COLUMN_KEY", 3, MYSQL_TYPE_STRING, 0, 0, "Key", OPEN_FRM_ONLY},
{"EXTRA", 27, MYSQL_TYPE_STRING, 0, 0, "Extra", OPEN_FRM_ONLY}, {"EXTRA", 27, MYSQL_TYPE_STRING, 0, 0, "Extra", OPEN_FRM_ONLY},
{"PRIVILEGES", 80, MYSQL_TYPE_STRING, 0, 0, "Privileges", OPEN_FRM_ONLY}, {"PRIVILEGES", 80, MYSQL_TYPE_STRING, 0, 0, "Privileges", OPEN_FRM_ONLY},
{"COLUMN_COMMENT", 255, MYSQL_TYPE_STRING, 0, 0, "Comment", OPEN_FRM_ONLY}, {"COLUMN_COMMENT", COLUMN_COMMENT_MAXLEN, MYSQL_TYPE_STRING, 0, 0,
"Comment", OPEN_FRM_ONLY},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
}; };
...@@ -6917,6 +6931,8 @@ ST_FIELD_INFO stat_fields_info[]= ...@@ -6917,6 +6931,8 @@ ST_FIELD_INFO stat_fields_info[]=
{"NULLABLE", 3, MYSQL_TYPE_STRING, 0, 0, "Null", OPEN_FRM_ONLY}, {"NULLABLE", 3, MYSQL_TYPE_STRING, 0, 0, "Null", OPEN_FRM_ONLY},
{"INDEX_TYPE", 16, MYSQL_TYPE_STRING, 0, 0, "Index_type", OPEN_FULL_TABLE}, {"INDEX_TYPE", 16, MYSQL_TYPE_STRING, 0, 0, "Index_type", OPEN_FULL_TABLE},
{"COMMENT", 16, MYSQL_TYPE_STRING, 0, 1, "Comment", OPEN_FRM_ONLY}, {"COMMENT", 16, MYSQL_TYPE_STRING, 0, 1, "Comment", OPEN_FRM_ONLY},
{"INDEX_COMMENT", INDEX_COMMENT_MAXLEN, MYSQL_TYPE_STRING, 0, 0,
"Index_comment", OPEN_FRM_ONLY},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
}; };
......
...@@ -2646,6 +2646,21 @@ CHARSET_INFO* get_sql_field_charset(Create_field *sql_field, ...@@ -2646,6 +2646,21 @@ CHARSET_INFO* get_sql_field_charset(Create_field *sql_field,
} }
bool check_duplicate_warning(THD *thd, char *msg, ulong length)
{
List_iterator_fast<MYSQL_ERROR> it(thd->warning_info->warn_list());
MYSQL_ERROR *err;
while ((err= it++))
{
if (strncmp(msg, err->get_message_text(), length) == 0)
{
return true;
}
}
return false;
}
/* /*
Preparation for table creation Preparation for table creation
...@@ -3486,6 +3501,40 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, ...@@ -3486,6 +3501,40 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
my_error(ER_TOO_LONG_KEY,MYF(0),max_key_length); my_error(ER_TOO_LONG_KEY,MYF(0),max_key_length);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
uint tmp_len= system_charset_info->cset->charpos(system_charset_info,
key->key_create_info.comment.str,
key->key_create_info.comment.str +
key->key_create_info.comment.length,
INDEX_COMMENT_MAXLEN);
if (tmp_len < key->key_create_info.comment.length)
{
if ((thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)))
{
my_error(ER_TOO_LONG_INDEX_COMMENT, MYF(0),
key_info->name, (uint) INDEX_COMMENT_MAXLEN);
DBUG_RETURN(-1);
}
char warn_buff[MYSQL_ERRMSG_SIZE];
my_snprintf(warn_buff, sizeof(warn_buff), ER(ER_TOO_LONG_INDEX_COMMENT),
key_info->name, (uint) INDEX_COMMENT_MAXLEN);
/* do not push duplicate warnings */
if (!check_duplicate_warning(thd, warn_buff, strlen(warn_buff)))
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TOO_LONG_INDEX_COMMENT, warn_buff);
key->key_create_info.comment.length= tmp_len;
}
key_info->comment.length= key->key_create_info.comment.length;
if (key_info->comment.length > 0)
{
key_info->flags|= HA_USES_COMMENT;
key_info->comment.str= key->key_create_info.comment.str;
}
key_info++; key_info++;
} }
if (!unique_key && !primary_key && if (!unique_key && !primary_key &&
...@@ -6196,6 +6245,8 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, ...@@ -6196,6 +6245,8 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
key_create_info.block_size= key_info->block_size; key_create_info.block_size= key_info->block_size;
if (key_info->flags & HA_USES_PARSER) if (key_info->flags & HA_USES_PARSER)
key_create_info.parser_name= *plugin_name(key_info->parser); key_create_info.parser_name= *plugin_name(key_info->parser);
if (key_info->flags & HA_USES_COMMENT)
key_create_info.comment= key_info->comment;
if (key_info->flags & HA_SPATIAL) if (key_info->flags & HA_SPATIAL)
key_type= Key::SPATIAL; key_type= Key::SPATIAL;
......
...@@ -6063,6 +6063,7 @@ key_using_alg: ...@@ -6063,6 +6063,7 @@ key_using_alg:
all_key_opt: all_key_opt:
KEY_BLOCK_SIZE opt_equal ulong_num KEY_BLOCK_SIZE opt_equal ulong_num
{ Lex->key_create_info.block_size= $3; } { Lex->key_create_info.block_size= $3; }
| COMMENT_SYM TEXT_STRING_sys { Lex->key_create_info.comment= $2; }
; ;
normal_key_opt: normal_key_opt:
......
...@@ -102,6 +102,7 @@ typedef struct st_key { ...@@ -102,6 +102,7 @@ typedef struct st_key {
int bdb_return_if_eq; int bdb_return_if_eq;
} handler; } handler;
TABLE *table; TABLE *table;
LEX_STRING comment;
} KEY; } KEY;
......
...@@ -517,7 +517,7 @@ int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags) ...@@ -517,7 +517,7 @@ int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags)
int error, table_type; int error, table_type;
bool error_given; bool error_given;
File file; File file;
uchar head[288], *disk_buff; uchar head[64], *disk_buff;
char path[FN_REFLEN]; char path[FN_REFLEN];
MEM_ROOT **root_ptr, *old_root; MEM_ROOT **root_ptr, *old_root;
DBUG_ENTER("open_table_def"); DBUG_ENTER("open_table_def");
...@@ -660,6 +660,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, ...@@ -660,6 +660,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
uint i,j; uint i,j;
bool use_hash; bool use_hash;
char *keynames, *names, *comment_pos; char *keynames, *names, *comment_pos;
uchar forminfo[288];
uchar *record; uchar *record;
uchar *disk_buff, *strpos, *null_flags, *null_pos; uchar *disk_buff, *strpos, *null_flags, *null_pos;
ulong pos, record_offset, *rec_per_key, rec_buff_length; ulong pos, record_offset, *rec_per_key, rec_buff_length;
...@@ -682,6 +683,9 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, ...@@ -682,6 +683,9 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
if (!(pos=get_form_pos(file,head,(TYPELIB*) 0))) if (!(pos=get_form_pos(file,head,(TYPELIB*) 0)))
goto err; /* purecov: inspected */ goto err; /* purecov: inspected */
mysql_file_seek(file,pos,MY_SEEK_SET,MYF(0));
if (mysql_file_read(file, forminfo,288,MYF(MY_NABP)))
goto err;
share->frm_version= head[2]; share->frm_version= head[2];
/* /*
Check if .frm file created by MySQL 5.0. In this case we want to Check if .frm file created by MySQL 5.0. In this case we want to
...@@ -827,6 +831,20 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, ...@@ -827,6 +831,20 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
keynames=(char*) key_part; keynames=(char*) key_part;
strpos+= (strmov(keynames, (char *) strpos) - keynames)+1; strpos+= (strmov(keynames, (char *) strpos) - keynames)+1;
//reading index comments
for (keyinfo= share->key_info, i=0; i < keys; i++, keyinfo++)
{
if (keyinfo->flags & HA_USES_COMMENT)
{
keyinfo->comment.length= uint2korr(strpos);
keyinfo->comment.str= strmake_root(&share->mem_root, (char*) strpos+2,
keyinfo->comment.length);
strpos+= 2 + keyinfo->comment.length;
}
DBUG_ASSERT(test(keyinfo->flags & HA_USES_COMMENT) ==
(keyinfo->comment.length > 0));
}
share->reclength = uint2korr((head+16)); share->reclength = uint2korr((head+16));
if (*(head+26) == 1) if (*(head+26) == 1)
share->system= 1; /* one-record-database */ share->system= 1; /* one-record-database */
...@@ -1007,6 +1025,25 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, ...@@ -1007,6 +1025,25 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
} }
} }
} }
if (forminfo[46] == (uchar)255)
{
//reading long table comment
if (next_chunk + 2 > buff_end)
{
DBUG_PRINT("error",
("long table comment is not defined in .frm"));
my_free(buff, MYF(0));
goto err;
}
share->comment.length = uint2korr(next_chunk);
if (! (share->comment.str= strmake_root(&share->mem_root,
(char*)next_chunk + 2, share->comment.length)))
{
my_free(buff, MYF(0));
goto err;
}
next_chunk+= 2 + share->comment.length;
}
my_free(buff, MYF(0)); my_free(buff, MYF(0));
} }
share->key_block_size= uint2korr(head+62); share->key_block_size= uint2korr(head+62);
...@@ -1023,29 +1060,30 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, ...@@ -1023,29 +1060,30 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
record_offset, MYF(MY_NABP))) record_offset, MYF(MY_NABP)))
goto err; /* purecov: inspected */ goto err; /* purecov: inspected */
mysql_file_seek(file, pos, MY_SEEK_SET, MYF(0)); mysql_file_seek(file, pos+288, MY_SEEK_SET, MYF(0));
if (mysql_file_read(file, head, 288, MYF(MY_NABP)))
goto err;
#ifdef HAVE_CRYPTED_FRM #ifdef HAVE_CRYPTED_FRM
if (crypted) if (crypted)
{ {
crypted->decode((char*) head+256,288-256); crypted->decode((char*) forminfo+256,288-256);
if (sint2korr(head+284) != 0) // Should be 0 if (sint2korr(forminfo+284) != 0) // Should be 0
goto err; // Wrong password goto err; // Wrong password
} }
#endif #endif
share->fields= uint2korr(head+258); share->fields= uint2korr(forminfo+258);
pos= uint2korr(head+260); /* Length of all screens */ pos= uint2korr(forminfo+260); /* Length of all screens */
n_length= uint2korr(head+268); n_length= uint2korr(forminfo+268);
interval_count= uint2korr(head+270); interval_count= uint2korr(forminfo+270);
interval_parts= uint2korr(head+272); interval_parts= uint2korr(forminfo+272);
int_length= uint2korr(head+274); int_length= uint2korr(forminfo+274);
share->null_fields= uint2korr(head+282); share->null_fields= uint2korr(forminfo+282);
com_length= uint2korr(head+284); com_length= uint2korr(forminfo+284);
share->comment.length= (int) (head[46]); if (forminfo[46] != (uchar)255)
share->comment.str= strmake_root(&share->mem_root, (char*) head+47, {
share->comment.length= (int) (forminfo[46]);
share->comment.str= strmake_root(&share->mem_root, (char*) forminfo+47,
share->comment.length); share->comment.length);
}
DBUG_PRINT("info",("i_count: %d i_parts: %d index: %d n_length: %d int_length: %d com_length: %d", interval_count,interval_parts, share->keys,n_length,int_length, com_length)); DBUG_PRINT("info",("i_count: %d i_parts: %d index: %d n_length: %d int_length: %d com_length: %d", interval_count,interval_parts, share->keys,n_length,int_length, com_length));
...@@ -2437,12 +2475,14 @@ void append_unescaped(String *res, const char *pos, uint length) ...@@ -2437,12 +2475,14 @@ void append_unescaped(String *res, const char *pos, uint length)
File create_frm(THD *thd, const char *name, const char *db, File create_frm(THD *thd, const char *name, const char *db,
const char *table, uint reclength, uchar *fileinfo, const char *table, uint reclength, uchar *fileinfo,
HA_CREATE_INFO *create_info, uint keys) HA_CREATE_INFO *create_info, uint keys, KEY *key_info)
{ {
register File file; register File file;
ulong length; ulong length;
uchar fill[IO_SIZE]; uchar fill[IO_SIZE];
int create_flags= O_RDWR | O_TRUNC; int create_flags= O_RDWR | O_TRUNC;
ulong key_comment_total_bytes= 0;
uint i;
if (create_info->options & HA_LEX_CREATE_TMP_TABLE) if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
create_flags|= O_EXCL | O_NOFOLLOW; create_flags|= O_EXCL | O_NOFOLLOW;
...@@ -2479,7 +2519,17 @@ File create_frm(THD *thd, const char *name, const char *db, ...@@ -2479,7 +2519,17 @@ File create_frm(THD *thd, const char *name, const char *db,
1 byte for the NAMES_SEP_CHAR (after the last name) 1 byte for the NAMES_SEP_CHAR (after the last name)
9 extra bytes (padding for safety? alignment?) 9 extra bytes (padding for safety? alignment?)
*/ */
key_length= keys * (8 + MAX_REF_PARTS * 9 + NAME_LEN + 1) + 16; for (i= 0; i < keys; i++)
{
DBUG_ASSERT(test(key_info[i].flags & HA_USES_COMMENT) ==
(key_info[i].comment.length > 0));
if (key_info[i].flags & HA_USES_COMMENT)
key_comment_total_bytes += 2 + key_info[i].comment.length;
}
key_length= keys * (8 + MAX_REF_PARTS * 9 + NAME_LEN + 1) + 16
+ key_comment_total_bytes;
length= next_io_size((ulong) (IO_SIZE+key_length+reclength+ length= next_io_size((ulong) (IO_SIZE+key_length+reclength+
create_info->extra_size)); create_info->extra_size));
int4store(fileinfo+10,length); int4store(fileinfo+10,length);
......
...@@ -188,27 +188,6 @@ bool mysql_create_frm(THD *thd, const char *file_name, ...@@ -188,27 +188,6 @@ bool mysql_create_frm(THD *thd, const char *file_name,
if (key_info[i].parser_name) if (key_info[i].parser_name)
create_info->extra_size+= key_info[i].parser_name->length + 1; create_info->extra_size+= key_info[i].parser_name->length + 1;
} }
if ((file=create_frm(thd, file_name, db, table, reclength, fileinfo,
create_info, keys)) < 0)
{
my_free(screen_buff, MYF(0));
DBUG_RETURN(1);
}
key_buff_length= uint4korr(fileinfo+47);
keybuff=(uchar*) my_malloc(key_buff_length, MYF(0));
key_info_length= pack_keys(keybuff, keys, key_info, data_offset);
(void) get_form_pos(file,fileinfo,&formnames);
if (!(filepos=make_new_entry(file,fileinfo,&formnames,"")))
goto err;
maxlength=(uint) next_io_size((ulong) (uint2korr(forminfo)+1000));
int2store(forminfo+2,maxlength);
int4store(fileinfo+10,(ulong) (filepos+maxlength));
fileinfo[26]= (uchar) test((create_info->max_rows == 1) &&
(create_info->min_rows == 1) && (keys == 0));
int2store(fileinfo+28,key_info_length);
/* /*
This gives us the byte-position of the character at This gives us the byte-position of the character at
(character-position, not byte-position) TABLE_COMMENT_MAXLEN. (character-position, not byte-position) TABLE_COMMENT_MAXLEN.
...@@ -222,33 +201,78 @@ bool mysql_create_frm(THD *thd, const char *file_name, ...@@ -222,33 +201,78 @@ bool mysql_create_frm(THD *thd, const char *file_name,
string), the string is too long. string), the string is too long.
For additional credit, realise that UTF-8 has 1-3 bytes before 6.0, For additional credit, realise that UTF-8 has 1-3 bytes before 6.0,
and 1-4 bytes in 6.0 (6.0 also has UTF-32). This means that the and 1-4 bytes in 6.0 (6.0 also has UTF-32).
inlined COMMENT supposedly does not exceed 60 character plus
terminator, vulgo, 181 bytes.
*/ */
tmp_len= system_charset_info->cset->charpos(system_charset_info, tmp_len= system_charset_info->cset->charpos(system_charset_info,
create_info->comment.str, create_info->comment.str,
create_info->comment.str + create_info->comment.str +
create_info->comment.length, 60); create_info->comment.length,
TABLE_COMMENT_MAXLEN);
if (tmp_len < create_info->comment.length) if (tmp_len < create_info->comment.length)
{ {
char *real_table_name= (char*) table;
List_iterator<Create_field> it(create_fields);
Create_field *field;
while ((field=it++))
{
if (field->field && field->field->table &&
(real_table_name= field->field->table->s->table_name.str))
break;
}
if ((thd->variables.sql_mode & if ((thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES))) (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)))
{ {
my_error(ER_TOO_LONG_TABLE_COMMENT, MYF(0), table, tmp_len); my_error(ER_TOO_LONG_TABLE_COMMENT, MYF(0),
goto err; real_table_name, (uint) TABLE_COMMENT_MAXLEN);
my_free(screen_buff,MYF(0));
DBUG_RETURN(1);
} }
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, char warn_buff[MYSQL_ERRMSG_SIZE];
ER_TOO_LONG_TABLE_COMMENT, my_snprintf(warn_buff, sizeof(warn_buff), ER(ER_TOO_LONG_TABLE_COMMENT),
ER(ER_TOO_LONG_TABLE_COMMENT), real_table_name, (uint) TABLE_COMMENT_MAXLEN);
table, tmp_len); /* do not push duplicate warnings */
if (!check_duplicate_warning(current_thd, warn_buff, strlen(warn_buff)))
push_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TOO_LONG_TABLE_COMMENT, warn_buff);
create_info->comment.length= tmp_len; create_info->comment.length= tmp_len;
} }
/*
If table comment is longer than TABLE_COMMENT_INLINE_MAXLEN bytes,
store the comment in an extra segment (up to TABLE_COMMENT_MAXLEN bytes).
Pre 6.0, the limit was 60 characters, with no extra segment-handling.
*/
if (create_info->comment.length > TABLE_COMMENT_INLINE_MAXLEN)
{
forminfo[46]=255;
create_info->extra_size+= 2 + create_info->comment.length;
}
else{
strmake((char*) forminfo+47, create_info->comment.str ? strmake((char*) forminfo+47, create_info->comment.str ?
create_info->comment.str : "", create_info->comment.length); create_info->comment.str : "", create_info->comment.length);
forminfo[46]=(uchar) create_info->comment.length; forminfo[46]=(uchar) create_info->comment.length;
}
if ((file=create_frm(thd, file_name, db, table, reclength, fileinfo,
create_info, keys, key_info)) < 0)
{
my_free(screen_buff, MYF(0));
DBUG_RETURN(1);
}
key_buff_length= uint4korr(fileinfo+47);
keybuff=(uchar*) my_malloc(key_buff_length, MYF(0));
key_info_length= pack_keys(keybuff, keys, key_info, data_offset);
(void) get_form_pos(file,fileinfo,&formnames);
if (!(filepos=make_new_entry(file,fileinfo,&formnames,"")))
goto err;
maxlength=(uint) next_io_size((ulong) (uint2korr(forminfo)+1000));
int2store(forminfo+2,maxlength);
int4store(fileinfo+10,(ulong) (filepos+maxlength));
fileinfo[26]= (uchar) test((create_info->max_rows == 1) &&
(create_info->min_rows == 1) && (keys == 0));
int2store(fileinfo+28,key_info_length);
#ifdef WITH_PARTITION_STORAGE_ENGINE #ifdef WITH_PARTITION_STORAGE_ENGINE
if (part_info) if (part_info)
{ {
...@@ -309,6 +333,15 @@ bool mysql_create_frm(THD *thd, const char *file_name, ...@@ -309,6 +333,15 @@ bool mysql_create_frm(THD *thd, const char *file_name,
goto err; goto err;
} }
} }
if (forminfo[46] == (uchar)255)
{
uchar comment_length_buff[2];
int2store(comment_length_buff,create_info->comment.length);
if (mysql_file_write(file, comment_length_buff, 2, MYF(MY_NABP)) ||
mysql_file_write(file, (uchar*) create_info->comment.str,
create_info->comment.length, MYF(MY_NABP)))
goto err;
}
mysql_file_seek(file, filepos, MY_SEEK_SET, MYF(0)); mysql_file_seek(file, filepos, MY_SEEK_SET, MYF(0));
if (mysql_file_write(file, forminfo, 288, MYF_RW) || if (mysql_file_write(file, forminfo, 288, MYF_RW) ||
...@@ -561,6 +594,16 @@ static uint pack_keys(uchar *keybuff, uint key_count, KEY *keyinfo, ...@@ -561,6 +594,16 @@ static uint pack_keys(uchar *keybuff, uint key_count, KEY *keyinfo,
pos=tmp; pos=tmp;
} }
*(pos++)=0; *(pos++)=0;
for (key=keyinfo,end=keyinfo+key_count ; key != end ; key++)
{
if (key->flags & HA_USES_COMMENT)
{
int2store(pos, key->comment.length);
uchar *tmp= (uchar*)strnmov((char*) pos+2,key->comment.str,
key->comment.length);
pos= tmp;
}
}
if (key_count > 127 || key_parts > 127) if (key_count > 127 || key_parts > 127)
{ {
...@@ -614,19 +657,23 @@ static bool pack_header(uchar *forminfo, enum legacy_db_type table_type, ...@@ -614,19 +657,23 @@ static bool pack_header(uchar *forminfo, enum legacy_db_type table_type,
field->comment.str, field->comment.str,
field->comment.str + field->comment.str +
field->comment.length, field->comment.length,
255); COLUMN_COMMENT_MAXLEN);
if (tmp_len < field->comment.length) if (tmp_len < field->comment.length)
{ {
if ((current_thd->variables.sql_mode & if ((current_thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES))) (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)))
{ {
my_error(ER_TOO_LONG_FIELD_COMMENT, MYF(0), field->field_name, tmp_len); my_error(ER_TOO_LONG_FIELD_COMMENT, MYF(0),
field->field_name, (uint) COLUMN_COMMENT_MAXLEN);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, char warn_buff[MYSQL_ERRMSG_SIZE];
ER_TOO_LONG_FIELD_COMMENT, my_snprintf(warn_buff, sizeof(warn_buff), ER(ER_TOO_LONG_FIELD_COMMENT),
ER(ER_TOO_LONG_FIELD_COMMENT), field->field_name, (uint) COLUMN_COMMENT_MAXLEN);
field->field_name, tmp_len); /* do not push duplicate warnings */
if (!check_duplicate_warning(current_thd, warn_buff, strlen(warn_buff)))
push_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TOO_LONG_FIELD_COMMENT, warn_buff);
field->comment.length= tmp_len; field->comment.length= tmp_len;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment