Commit a8efd33a authored by msvensson@neptunus.(none)'s avatar msvensson@neptunus.(none)

Merge neptunus.(none):/home/msvensson/mysql/bug11635/my41-bug11635

into neptunus.(none):/home/msvensson/mysql/mysql-4.1
parents 61db7856 50133499
...@@ -412,7 +412,7 @@ show create table t1; ...@@ -412,7 +412,7 @@ show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`c` char(10) character set utf8 default NULL, `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 ) ENGINE=HEAP DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa'); insert into t1 values ('aa');
...@@ -448,7 +448,7 @@ show create table t1; ...@@ -448,7 +448,7 @@ show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`c` char(10) character set utf8 default NULL, `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 ) ENGINE=HEAP DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa'); insert into t1 values ('aa');
...@@ -570,7 +570,7 @@ show create table t1; ...@@ -570,7 +570,7 @@ show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`c` char(10) character set utf8 collate utf8_bin default NULL, `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 ) ENGINE=HEAP DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa'); insert into t1 values ('aa');
...@@ -606,7 +606,7 @@ show create table t1; ...@@ -606,7 +606,7 @@ show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`c` char(10) character set utf8 collate utf8_bin default NULL, `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 ) ENGINE=HEAP DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa'); insert into t1 values ('aa');
......
...@@ -420,7 +420,7 @@ SHOW CREATE TABLE t1; ...@@ -420,7 +420,7 @@ SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`i` int(11) default NULL, `i` int(11) default NULL,
KEY `i` TYPE HASH (`i`) KEY `i` USING HASH (`i`)
) ENGINE=HEAP DEFAULT CHARSET=latin1 ) ENGINE=HEAP DEFAULT CHARSET=latin1
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MEMORY; CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MEMORY;
...@@ -428,7 +428,7 @@ SHOW CREATE TABLE t1; ...@@ -428,7 +428,7 @@ SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`i` int(11) default NULL, `i` int(11) default NULL,
KEY `i` TYPE BTREE (`i`) KEY `i` USING BTREE (`i`)
) ENGINE=HEAP DEFAULT CHARSET=latin1 ) ENGINE=HEAP DEFAULT CHARSET=latin1
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM; CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
...@@ -444,7 +444,7 @@ SHOW CREATE TABLE t1; ...@@ -444,7 +444,7 @@ SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`i` int(11) default NULL, `i` int(11) default NULL,
KEY `i` TYPE BTREE (`i`) KEY `i` USING BTREE (`i`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM; CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
...@@ -467,14 +467,14 @@ SHOW CREATE TABLE t1; ...@@ -467,14 +467,14 @@ SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`i` int(11) default NULL, `i` int(11) default NULL,
KEY `i` TYPE BTREE (`i`) KEY `i` USING BTREE (`i`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t1 ENGINE=MEMORY; ALTER TABLE t1 ENGINE=MEMORY;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`i` int(11) default NULL, `i` int(11) default NULL,
KEY `i` TYPE BTREE (`i`) KEY `i` USING BTREE (`i`)
) ENGINE=HEAP DEFAULT CHARSET=latin1 ) ENGINE=HEAP DEFAULT CHARSET=latin1
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1( CREATE TABLE t1(
...@@ -498,3 +498,18 @@ def Comment 253 255 0 N 129 31 63 ...@@ -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 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 t1 0 PRIMARY 1 field1 A 0 1000 NULL BTREE
drop table t1; 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` ( ...@@ -17,7 +17,7 @@ t1 CREATE TABLE `t1` (
`pseudo` varchar(35) character set latin2 NOT NULL default '', `pseudo` varchar(35) character set latin2 NOT NULL default '',
`email` varchar(60) character set latin2 NOT NULL default '', `email` varchar(60) character set latin2 NOT NULL default '',
PRIMARY KEY (`a`), PRIMARY KEY (`a`),
UNIQUE KEY `email` TYPE BTREE (`email`) UNIQUE KEY `email` USING BTREE (`email`)
) ENGINE=HEAP DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC ) ENGINE=HEAP DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
set @@sql_mode="ansi_quotes"; set @@sql_mode="ansi_quotes";
show variables like 'sql_mode'; show variables like 'sql_mode';
...@@ -30,7 +30,7 @@ t1 CREATE TABLE "t1" ( ...@@ -30,7 +30,7 @@ t1 CREATE TABLE "t1" (
"pseudo" varchar(35) character set latin2 NOT NULL default '', "pseudo" varchar(35) character set latin2 NOT NULL default '',
"email" varchar(60) character set latin2 NOT NULL default '', "email" varchar(60) character set latin2 NOT NULL default '',
PRIMARY KEY ("a"), PRIMARY KEY ("a"),
UNIQUE KEY "email" TYPE BTREE ("email") UNIQUE KEY "email" USING BTREE ("email")
) ENGINE=HEAP DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC ) ENGINE=HEAP DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
set @@sql_mode="no_table_options"; set @@sql_mode="no_table_options";
show variables like 'sql_mode'; show variables like 'sql_mode';
...@@ -43,7 +43,7 @@ t1 CREATE TABLE `t1` ( ...@@ -43,7 +43,7 @@ t1 CREATE TABLE `t1` (
`pseudo` varchar(35) character set latin2 NOT NULL default '', `pseudo` varchar(35) character set latin2 NOT NULL default '',
`email` varchar(60) character set latin2 NOT NULL default '', `email` varchar(60) character set latin2 NOT NULL default '',
PRIMARY KEY (`a`), PRIMARY KEY (`a`),
UNIQUE KEY `email` TYPE BTREE (`email`) UNIQUE KEY `email` USING BTREE (`email`)
) )
set @@sql_mode="no_key_options"; set @@sql_mode="no_key_options";
show variables like 'sql_mode'; show variables like 'sql_mode';
......
...@@ -368,3 +368,12 @@ show index from t1; ...@@ -368,3 +368,12 @@ show index from t1;
--disable_metadata --disable_metadata
drop table t1; 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) ...@@ -1414,15 +1414,15 @@ store_create_info(THD *thd, TABLE *table, String *packet)
!limited_mysql_mode && !foreign_db_mode) !limited_mysql_mode && !foreign_db_mode)
{ {
if (key_info->algorithm == HA_KEY_ALG_BTREE) 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) 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 // +BAR: send USING only in non-default case: non-spatial rtree
if ((key_info->algorithm == HA_KEY_ALG_RTREE) && if ((key_info->algorithm == HA_KEY_ALG_RTREE) &&
!(key_info->flags & HA_SPATIAL)) !(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 // 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