mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
BDB: Bug#4531: unique key prefix interacts poorly with utf8,
Bug#4594 column index make = failed for gbk myisam/mi_key.c: cleanup
This commit is contained in:
@ -412,6 +412,36 @@ select c as c_a from t1 where c='б';
|
||||
c_a
|
||||
б
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
c char(10) character set utf8,
|
||||
unique key a (c(1))
|
||||
) engine=bdb;
|
||||
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
|
||||
insert into t1 values ('aa');
|
||||
ERROR 23000: Duplicate entry 'aa' for key 1
|
||||
insert into t1 values ('aaa');
|
||||
ERROR 23000: Duplicate entry 'aaa' for key 1
|
||||
insert into t1 values ('б');
|
||||
insert into t1 values ('бб');
|
||||
ERROR 23000: Duplicate entry 'б<>' for key 1
|
||||
insert into t1 values ('ббб');
|
||||
ERROR 23000: Duplicate entry 'б<>' for key 1
|
||||
select c as c_all from t1 order by c;
|
||||
c_all
|
||||
a
|
||||
b
|
||||
c
|
||||
d
|
||||
e
|
||||
f
|
||||
б
|
||||
select c as c_a from t1 where c='a';
|
||||
c_a
|
||||
a
|
||||
select c as c_a from t1 where c='б';
|
||||
c_a
|
||||
б
|
||||
drop table t1;
|
||||
create table t1 (c varchar(30) character set utf8 collate utf8_bin, unique(c(10)));
|
||||
insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
|
||||
insert into t1 values ('aaaaaaaaaa');
|
||||
@ -541,6 +571,36 @@ c_a
|
||||
б
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
c char(10) character set utf8 collate utf8_bin,
|
||||
unique key a (c(1))
|
||||
) engine=bdb;
|
||||
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
|
||||
insert into t1 values ('aa');
|
||||
ERROR 23000: Duplicate entry 'aa' for key 1
|
||||
insert into t1 values ('aaa');
|
||||
ERROR 23000: Duplicate entry 'aaa' for key 1
|
||||
insert into t1 values ('б');
|
||||
insert into t1 values ('бб');
|
||||
ERROR 23000: Duplicate entry 'б<>' for key 1
|
||||
insert into t1 values ('ббб');
|
||||
ERROR 23000: Duplicate entry 'б<>' for key 1
|
||||
select c as c_all from t1 order by c;
|
||||
c_all
|
||||
a
|
||||
b
|
||||
c
|
||||
d
|
||||
e
|
||||
f
|
||||
б
|
||||
select c as c_a from t1 where c='a';
|
||||
c_a
|
||||
a
|
||||
select c as c_a from t1 where c='б';
|
||||
c_a
|
||||
б
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
str varchar(255) character set utf8 not null,
|
||||
key str (str(2))
|
||||
) engine=myisam;
|
||||
@ -570,3 +630,13 @@ select * from t1 where str='str';
|
||||
str
|
||||
str
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
str varchar(255) character set utf8 not null,
|
||||
key str (str(2))
|
||||
) engine=bdb;
|
||||
INSERT INTO t1 VALUES ('str');
|
||||
INSERT INTO t1 VALUES ('str2');
|
||||
select * from t1 where str='str';
|
||||
str
|
||||
str
|
||||
drop table t1;
|
||||
|
@ -294,6 +294,30 @@ select c as c_a from t1 where c='a';
|
||||
select c as c_a from t1 where c='б';
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug 4531: unique key prefix interacts poorly with utf8
|
||||
# Check BDB, case insensitive collation
|
||||
#
|
||||
--disable_warnings
|
||||
create table t1 (
|
||||
c char(10) character set utf8,
|
||||
unique key a (c(1))
|
||||
) engine=bdb;
|
||||
--enable_warnings
|
||||
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
|
||||
--error 1062
|
||||
insert into t1 values ('aa');
|
||||
--error 1062
|
||||
insert into t1 values ('aaa');
|
||||
insert into t1 values ('б');
|
||||
--error 1062
|
||||
insert into t1 values ('бб');
|
||||
--error 1062
|
||||
insert into t1 values ('ббб');
|
||||
select c as c_all from t1 order by c;
|
||||
select c as c_a from t1 where c='a';
|
||||
select c as c_a from t1 where c='б';
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug 4521: unique key prefix interacts poorly with utf8
|
||||
@ -393,6 +417,31 @@ select c as c_a from t1 where c='a';
|
||||
select c as c_a from t1 where c='б';
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug 4531: unique key prefix interacts poorly with utf8
|
||||
# Check BDB, binary collation
|
||||
#
|
||||
--disable_warnings
|
||||
create table t1 (
|
||||
c char(10) character set utf8 collate utf8_bin,
|
||||
unique key a (c(1))
|
||||
) engine=bdb;
|
||||
--enable_warnings
|
||||
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
|
||||
--error 1062
|
||||
insert into t1 values ('aa');
|
||||
--error 1062
|
||||
insert into t1 values ('aaa');
|
||||
insert into t1 values ('б');
|
||||
--error 1062
|
||||
insert into t1 values ('бб');
|
||||
--error 1062
|
||||
insert into t1 values ('ббб');
|
||||
select c as c_all from t1 order by c;
|
||||
select c as c_a from t1 where c='a';
|
||||
select c as c_a from t1 where c='б';
|
||||
drop table t1;
|
||||
|
||||
|
||||
# Bug#4594: column index make = failed for gbk, but like works
|
||||
# Check MYISAM
|
||||
@ -429,3 +478,18 @@ INSERT INTO t1 VALUES ('str');
|
||||
INSERT INTO t1 VALUES ('str2');
|
||||
select * from t1 where str='str';
|
||||
drop table t1;
|
||||
|
||||
# the same for BDB
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
create table t1 (
|
||||
str varchar(255) character set utf8 not null,
|
||||
key str (str(2))
|
||||
) engine=bdb;
|
||||
--enable_warnings
|
||||
INSERT INTO t1 VALUES ('str');
|
||||
INSERT INTO t1 VALUES ('str2');
|
||||
select * from t1 where str='str';
|
||||
drop table t1;
|
||||
|
||||
|
Reference in New Issue
Block a user