mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
Fix reporting of type for unique key on VARCHAR field. (Bug #11227)
This commit is contained in:
parent
bafab2dd6f
commit
1d19a4e737
3 changed files with 44 additions and 4 deletions
|
@ -354,3 +354,28 @@ t1 CREATE TABLE `t1` (
|
|||
KEY `a` (`a`,`b`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 (a int not null primary key, b varchar(20) not null unique);
|
||||
desc t1;
|
||||
Field Type Null Key Default Extra
|
||||
a int(11) NO PRI
|
||||
b varchar(20) NO UNI
|
||||
drop table t1;
|
||||
create table t1 (a int not null primary key, b int not null unique);
|
||||
desc t1;
|
||||
Field Type Null Key Default Extra
|
||||
a int(11) NO PRI
|
||||
b int(11) NO UNI
|
||||
drop table t1;
|
||||
create table t1 (a int not null primary key, b varchar(20) not null, unique (b(10)));
|
||||
desc t1;
|
||||
Field Type Null Key Default Extra
|
||||
a int(11) NO PRI
|
||||
b varchar(20) NO UNI
|
||||
drop table t1;
|
||||
create table t1 (a int not null primary key, b varchar(20) not null, c varchar(20) not null, unique(b(10),c(10)));
|
||||
desc t1;
|
||||
Field Type Null Key Default Extra
|
||||
a int(11) NO PRI
|
||||
b varchar(20) NO MUL
|
||||
c varchar(20) NO
|
||||
drop table t1;
|
||||
|
|
|
@ -337,3 +337,19 @@ show create table t1;
|
|||
alter table t1 modify a varchar(20);
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #11227: Incorrectly reporting 'MUL' vs. 'UNI' on varchar
|
||||
#
|
||||
create table t1 (a int not null primary key, b varchar(20) not null unique);
|
||||
desc t1;
|
||||
drop table t1;
|
||||
create table t1 (a int not null primary key, b int not null unique);
|
||||
desc t1;
|
||||
drop table t1;
|
||||
create table t1 (a int not null primary key, b varchar(20) not null, unique (b(10)));
|
||||
desc t1;
|
||||
drop table t1;
|
||||
create table t1 (a int not null primary key, b varchar(20) not null, c varchar(20) not null, unique(b(10),c(10)));
|
||||
desc t1;
|
||||
drop table t1;
|
||||
|
|
|
@ -701,10 +701,9 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
|
|||
key_part->key_part_flag|= HA_BIT_PART;
|
||||
|
||||
if (i == 0 && key != primary_key)
|
||||
field->flags |=
|
||||
((keyinfo->flags & HA_NOSAME) &&
|
||||
field->key_length() ==
|
||||
keyinfo->key_length ? UNIQUE_KEY_FLAG : MULTIPLE_KEY_FLAG);
|
||||
field->flags |= ((keyinfo->flags & HA_NOSAME) &&
|
||||
(keyinfo->key_parts == 1)) ?
|
||||
UNIQUE_KEY_FLAG : MULTIPLE_KEY_FLAG;
|
||||
if (i == 0)
|
||||
field->key_start.set_bit(key);
|
||||
if (field->key_length() == key_part->length &&
|
||||
|
|
Loading…
Reference in a new issue