BUG#11635 mysqldump exports TYPE instead of USING for HASH Cluster indexes

  - Change output from SHOW CREATE TABLE to use USING instead of TYPE
parent ac8f9d38
......@@ -412,7 +412,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` char(10) character set utf8 default NULL,
UNIQUE KEY `a` TYPE HASH (`c`(1))
UNIQUE KEY `a` USING HASH (`c`(1))
) ENGINE=HEAP DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa');
......@@ -448,7 +448,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` char(10) character set utf8 default NULL,
UNIQUE KEY `a` TYPE BTREE (`c`(1))
UNIQUE KEY `a` USING BTREE (`c`(1))
) ENGINE=HEAP DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa');
......@@ -570,7 +570,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` char(10) character set utf8 collate utf8_bin default NULL,
UNIQUE KEY `a` TYPE HASH (`c`(1))
UNIQUE KEY `a` USING HASH (`c`(1))
) ENGINE=HEAP DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa');
......@@ -606,7 +606,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` char(10) character set utf8 collate utf8_bin default NULL,
UNIQUE KEY `a` TYPE BTREE (`c`(1))
UNIQUE KEY `a` USING BTREE (`c`(1))
) ENGINE=HEAP DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa');
......
......@@ -420,7 +420,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) default NULL,
KEY `i` TYPE HASH (`i`)
KEY `i` USING HASH (`i`)
) ENGINE=HEAP DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MEMORY;
......@@ -428,7 +428,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) default NULL,
KEY `i` TYPE BTREE (`i`)
KEY `i` USING BTREE (`i`)
) ENGINE=HEAP DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
......@@ -444,7 +444,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) default NULL,
KEY `i` TYPE BTREE (`i`)
KEY `i` USING BTREE (`i`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
......@@ -467,14 +467,14 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) default NULL,
KEY `i` TYPE BTREE (`i`)
KEY `i` USING BTREE (`i`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t1 ENGINE=MEMORY;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) default NULL,
KEY `i` TYPE BTREE (`i`)
KEY `i` USING BTREE (`i`)
) ENGINE=HEAP DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1(
......@@ -498,3 +498,18 @@ def Comment 253 255 0 N 129 31 63
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 0 PRIMARY 1 field1 A 0 1000 NULL BTREE
drop table t1;
create table t1 (
c1 int NOT NULL,
c2 int NOT NULL,
PRIMARY KEY USING HASH (c1),
INDEX USING BTREE(c2)
);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL default '0',
`c2` int(11) NOT NULL default '0',
PRIMARY KEY USING HASH (`c1`),
KEY `c2` USING BTREE (`c2`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
......@@ -17,7 +17,7 @@ t1 CREATE TABLE `t1` (
`pseudo` varchar(35) character set latin2 NOT NULL default '',
`email` varchar(60) character set latin2 NOT NULL default '',
PRIMARY KEY (`a`),
UNIQUE KEY `email` TYPE BTREE (`email`)
UNIQUE KEY `email` USING BTREE (`email`)
) ENGINE=HEAP DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
set @@sql_mode="ansi_quotes";
show variables like 'sql_mode';
......@@ -30,7 +30,7 @@ t1 CREATE TABLE "t1" (
"pseudo" varchar(35) character set latin2 NOT NULL default '',
"email" varchar(60) character set latin2 NOT NULL default '',
PRIMARY KEY ("a"),
UNIQUE KEY "email" TYPE BTREE ("email")
UNIQUE KEY "email" USING BTREE ("email")
) ENGINE=HEAP DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
set @@sql_mode="no_table_options";
show variables like 'sql_mode';
......@@ -43,7 +43,7 @@ t1 CREATE TABLE `t1` (
`pseudo` varchar(35) character set latin2 NOT NULL default '',
`email` varchar(60) character set latin2 NOT NULL default '',
PRIMARY KEY (`a`),
UNIQUE KEY `email` TYPE BTREE (`email`)
UNIQUE KEY `email` USING BTREE (`email`)
)
set @@sql_mode="no_key_options";
show variables like 'sql_mode';
......
......@@ -368,3 +368,12 @@ show index from t1;
--disable_metadata
drop table t1;
# Test for BUG#11635: mysqldump exports TYPE instead of USING for HASH
create table t1 (
c1 int NOT NULL,
c2 int NOT NULL,
PRIMARY KEY USING HASH (c1),
INDEX USING BTREE(c2)
);
SHOW CREATE TABLE t1;
DROP TABLE t1;
......@@ -1414,15 +1414,15 @@ store_create_info(THD *thd, TABLE *table, String *packet)
!limited_mysql_mode && !foreign_db_mode)
{
if (key_info->algorithm == HA_KEY_ALG_BTREE)
packet->append(" TYPE BTREE", 11);
packet->append(" USING BTREE", 12);
if (key_info->algorithm == HA_KEY_ALG_HASH)
packet->append(" TYPE HASH", 10);
packet->append(" USING HASH", 11);
// +BAR: send USING only in non-default case: non-spatial rtree
if ((key_info->algorithm == HA_KEY_ALG_RTREE) &&
!(key_info->flags & HA_SPATIAL))
packet->append(" TYPE RTREE", 11);
packet->append(" USING RTREE", 12);
// No need to send TYPE FULLTEXT, it is sent as FULLTEXT KEY
}
......
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