mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
ctype_ujis.result, ctype_ujis.test, field.cc:
Bug#6345 Unexpected behaviour with partial indices
This commit is contained in:
parent
681b6e9562
commit
b7776f83e7
3 changed files with 82 additions and 2 deletions
|
@ -126,3 +126,43 @@ Field Type Null Key Default Extra
|
|||
a char(1)
|
||||
b enum('あ','い') YES NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1
|
||||
(
|
||||
a INTEGER NOT NULL,
|
||||
b VARCHAR(50) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (a),
|
||||
KEY b (b(10))
|
||||
) TYPE=InnoDB CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
|
||||
INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd');
|
||||
INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh');
|
||||
INSERT INTO t1 (a, b) VALUES (2, 'iiijjjkkkl');
|
||||
SELECT t1.* FROM t1 WHERE b='aaabbbcccddd' ORDER BY a;
|
||||
a b
|
||||
0 aaabbbcccddd
|
||||
SELECT t1.* FROM t1 WHERE b='eeefffggghhh' ORDER BY a;
|
||||
a b
|
||||
1 eeefffggghhh
|
||||
SELECT t1.* FROM t1 WHERE b='iiijjjkkkl' ORDER BY a;
|
||||
a b
|
||||
2 iiijjjkkkl
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1
|
||||
(
|
||||
a INTEGER NOT NULL,
|
||||
b VARCHAR(50) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (a),
|
||||
KEY b (b(10))
|
||||
) TYPE=MyISAM CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
|
||||
INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd');
|
||||
INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh');
|
||||
INSERT INTO t1 (a, b) VALUES (2, 'iiijjjkkkl');
|
||||
SELECT t1.* FROM t1 WHERE b='aaabbbcccddd' ORDER BY a;
|
||||
a b
|
||||
0 aaabbbcccddd
|
||||
SELECT t1.* FROM t1 WHERE b='eeefffggghhh' ORDER BY a;
|
||||
a b
|
||||
1 eeefffggghhh
|
||||
SELECT t1.* FROM t1 WHERE b='iiijjjkkkl' ORDER BY a;
|
||||
a b
|
||||
2 iiijjjkkkl
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -83,3 +83,39 @@ CREATE TABLE t1 (
|
|||
SHOW CREATE TABLE t1;
|
||||
SHOW COLUMNS FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #6345 Unexpected behaviour with partial indices
|
||||
#
|
||||
--disable_warnings
|
||||
CREATE TABLE t1
|
||||
(
|
||||
a INTEGER NOT NULL,
|
||||
b VARCHAR(50) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (a),
|
||||
KEY b (b(10))
|
||||
) TYPE=InnoDB CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
|
||||
--enable_warnings
|
||||
INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd');
|
||||
INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh');
|
||||
INSERT INTO t1 (a, b) VALUES (2, 'iiijjjkkkl');
|
||||
SELECT t1.* FROM t1 WHERE b='aaabbbcccddd' ORDER BY a;
|
||||
SELECT t1.* FROM t1 WHERE b='eeefffggghhh' ORDER BY a;
|
||||
SELECT t1.* FROM t1 WHERE b='iiijjjkkkl' ORDER BY a;
|
||||
DROP TABLE t1;
|
||||
--disable_warnings
|
||||
CREATE TABLE t1
|
||||
(
|
||||
a INTEGER NOT NULL,
|
||||
b VARCHAR(50) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (a),
|
||||
KEY b (b(10))
|
||||
) TYPE=MyISAM CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
|
||||
--enable_warnings
|
||||
INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd');
|
||||
INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh');
|
||||
INSERT INTO t1 (a, b) VALUES (2, 'iiijjjkkkl');
|
||||
SELECT t1.* FROM t1 WHERE b='aaabbbcccddd' ORDER BY a;
|
||||
SELECT t1.* FROM t1 WHERE b='eeefffggghhh' ORDER BY a;
|
||||
SELECT t1.* FROM t1 WHERE b='iiijjjkkkl' ORDER BY a;
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -4401,10 +4401,14 @@ int Field_string::cmp(const char *a_ptr, const char *b_ptr)
|
|||
(const uchar*) b_ptr,
|
||||
field_length);
|
||||
}
|
||||
return my_strnncoll(field_charset,(const uchar*) a_ptr, field_length,
|
||||
(const uchar*) b_ptr, field_length);
|
||||
uint char_len= field_length/field_charset->mbmaxlen;
|
||||
uint a_len= my_charpos(field_charset, a_ptr, a_ptr + field_length, char_len);
|
||||
uint b_len= my_charpos(field_charset, b_ptr, b_ptr + field_length, char_len);
|
||||
return my_strnncoll(field_charset,(const uchar*) a_ptr, a_len,
|
||||
(const uchar*) b_ptr, b_len);
|
||||
}
|
||||
|
||||
|
||||
void Field_string::sort_string(char *to,uint length)
|
||||
{
|
||||
uint tmp=my_strnxfrm(field_charset,
|
||||
|
|
Loading…
Reference in a new issue