Loading include/my_base.h +1 −1 Original line number Diff line number Diff line Loading @@ -224,7 +224,7 @@ enum ha_base_keytype { #define HA_SPATIAL 1024 /* For spatial search */ #define HA_NULL_ARE_EQUAL 2048 /* NULL in key are cmp as equal */ #define HA_GENERATED_KEY 8192 /* Automaticly generated key */ #define HA_KEY_HAS_PART_KEY_SEG 65536 /* Key contains partial segments */ /* Automatic bits in key-flag */ #define HA_SPACE_PACK_USED 4 /* Test for if SPACE_PACK used */ Loading mysql-test/r/innodb_mysql.result +15 −0 Original line number Diff line number Diff line Loading @@ -1211,4 +1211,19 @@ a b 3 2 1 1 DROP TABLE t1; create table t1(a char(10) not null, unique key aa(a(1)), b char(4) not null, unique key bb(b(4))) engine=innodb; desc t1; Field Type Null Key Default Extra a char(10) NO UNI NULL b char(4) NO PRI NULL show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) NOT NULL, `b` char(4) NOT NULL, UNIQUE KEY `bb` (`b`), UNIQUE KEY `aa` (`a`(1)) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; End of 5.0 tests mysql-test/r/key.result +44 −0 Original line number Diff line number Diff line Loading @@ -462,4 +462,48 @@ EXPLAIN SELECT MAX(a) FROM t1 FORCE INDEX(a); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 DROP TABLE t1; create table t1(a int not null, key aa(a), b char(10) not null, unique key bb(b(1)), c char(4) not null, unique key cc(c)); desc t1; Field Type Null Key Default Extra a int(11) NO MUL NULL b char(10) NO UNI NULL c char(4) NO PRI NULL show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` char(10) NOT NULL, `c` char(4) NOT NULL, UNIQUE KEY `cc` (`c`), UNIQUE KEY `bb` (`b`(1)), KEY `aa` (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1(a int not null, key aa(a), b char(10) not null, unique key bb(b(1)), c char(4) not null); desc t1; Field Type Null Key Default Extra a int(11) NO MUL NULL b char(10) NO UNI NULL c char(4) NO NULL alter table t1 add unique key cc(c); desc t1; Field Type Null Key Default Extra a int(11) NO MUL NULL b char(10) NO UNI NULL c char(4) NO PRI NULL show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` char(10) NOT NULL, `c` char(4) NOT NULL, UNIQUE KEY `cc` (`c`), UNIQUE KEY `bb` (`b`(1)), KEY `aa` (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; End of 5.0 tests. mysql-test/t/innodb_mysql.test +9 −0 Original line number Diff line number Diff line Loading @@ -960,4 +960,13 @@ SELECT * FROM t1 ORDER BY b DESC, a ASC; DROP TABLE t1; # # Bug #31137: Assertion failed: primary_key_no == -1 || primary_key_no == 0 # create table t1(a char(10) not null, unique key aa(a(1)), b char(4) not null, unique key bb(b(4))) engine=innodb; desc t1; show create table t1; drop table t1; --echo End of 5.0 tests mysql-test/t/key.test +18 −0 Original line number Diff line number Diff line Loading @@ -443,4 +443,22 @@ ALTER TABLE t1 DISABLE KEYS; EXPLAIN SELECT MAX(a) FROM t1 FORCE INDEX(a); DROP TABLE t1; # # Bug #31137: Assertion failed: primary_key_no == -1 || primary_key_no == 0 # create table t1(a int not null, key aa(a), b char(10) not null, unique key bb(b(1)), c char(4) not null, unique key cc(c)); desc t1; show create table t1; drop table t1; create table t1(a int not null, key aa(a), b char(10) not null, unique key bb(b(1)), c char(4) not null); desc t1; alter table t1 add unique key cc(c); desc t1; show create table t1; drop table t1; --echo End of 5.0 tests. Loading
include/my_base.h +1 −1 Original line number Diff line number Diff line Loading @@ -224,7 +224,7 @@ enum ha_base_keytype { #define HA_SPATIAL 1024 /* For spatial search */ #define HA_NULL_ARE_EQUAL 2048 /* NULL in key are cmp as equal */ #define HA_GENERATED_KEY 8192 /* Automaticly generated key */ #define HA_KEY_HAS_PART_KEY_SEG 65536 /* Key contains partial segments */ /* Automatic bits in key-flag */ #define HA_SPACE_PACK_USED 4 /* Test for if SPACE_PACK used */ Loading
mysql-test/r/innodb_mysql.result +15 −0 Original line number Diff line number Diff line Loading @@ -1211,4 +1211,19 @@ a b 3 2 1 1 DROP TABLE t1; create table t1(a char(10) not null, unique key aa(a(1)), b char(4) not null, unique key bb(b(4))) engine=innodb; desc t1; Field Type Null Key Default Extra a char(10) NO UNI NULL b char(4) NO PRI NULL show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) NOT NULL, `b` char(4) NOT NULL, UNIQUE KEY `bb` (`b`), UNIQUE KEY `aa` (`a`(1)) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; End of 5.0 tests
mysql-test/r/key.result +44 −0 Original line number Diff line number Diff line Loading @@ -462,4 +462,48 @@ EXPLAIN SELECT MAX(a) FROM t1 FORCE INDEX(a); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 DROP TABLE t1; create table t1(a int not null, key aa(a), b char(10) not null, unique key bb(b(1)), c char(4) not null, unique key cc(c)); desc t1; Field Type Null Key Default Extra a int(11) NO MUL NULL b char(10) NO UNI NULL c char(4) NO PRI NULL show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` char(10) NOT NULL, `c` char(4) NOT NULL, UNIQUE KEY `cc` (`c`), UNIQUE KEY `bb` (`b`(1)), KEY `aa` (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1(a int not null, key aa(a), b char(10) not null, unique key bb(b(1)), c char(4) not null); desc t1; Field Type Null Key Default Extra a int(11) NO MUL NULL b char(10) NO UNI NULL c char(4) NO NULL alter table t1 add unique key cc(c); desc t1; Field Type Null Key Default Extra a int(11) NO MUL NULL b char(10) NO UNI NULL c char(4) NO PRI NULL show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` char(10) NOT NULL, `c` char(4) NOT NULL, UNIQUE KEY `cc` (`c`), UNIQUE KEY `bb` (`b`(1)), KEY `aa` (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; End of 5.0 tests.
mysql-test/t/innodb_mysql.test +9 −0 Original line number Diff line number Diff line Loading @@ -960,4 +960,13 @@ SELECT * FROM t1 ORDER BY b DESC, a ASC; DROP TABLE t1; # # Bug #31137: Assertion failed: primary_key_no == -1 || primary_key_no == 0 # create table t1(a char(10) not null, unique key aa(a(1)), b char(4) not null, unique key bb(b(4))) engine=innodb; desc t1; show create table t1; drop table t1; --echo End of 5.0 tests
mysql-test/t/key.test +18 −0 Original line number Diff line number Diff line Loading @@ -443,4 +443,22 @@ ALTER TABLE t1 DISABLE KEYS; EXPLAIN SELECT MAX(a) FROM t1 FORCE INDEX(a); DROP TABLE t1; # # Bug #31137: Assertion failed: primary_key_no == -1 || primary_key_no == 0 # create table t1(a int not null, key aa(a), b char(10) not null, unique key bb(b(1)), c char(4) not null, unique key cc(c)); desc t1; show create table t1; drop table t1; create table t1(a int not null, key aa(a), b char(10) not null, unique key bb(b(1)), c char(4) not null); desc t1; alter table t1 add unique key cc(c); desc t1; show create table t1; drop table t1; --echo End of 5.0 tests.