summaryrefslogtreecommitdiff
path: root/heap
diff options
context:
space:
mode:
authorunknown <bar@mysql.com>2005-09-01 19:31:08 +0500
committerunknown <bar@mysql.com>2005-09-01 19:31:08 +0500
commit181d03b456f9c1eb25c6c3f1b3791c9a00149a5f (patch)
tree37a23e8ad0f418f227af4b303b5794cb498b7637 /heap
parentf81ecf6faee659b0fbf222fb68808ebfa394710a (diff)
downloadmariadb-git-181d03b456f9c1eb25c6c3f1b3791c9a00149a5f.tar.gz
Bug#12891:
UNION doesn't return DISTINCT result for multi-byte characters hp_hash.c: This piece of code was pretty wrong, looks like no necessary changes were made after cut-and-paste from fixed length segment processing. Itroduced two new variables safe_length1 and safe_length2 to remember the original lengths. Fixing my_charpos and set_if_smaller calls to pass correct parameters. ctype_utf8.result, ctype_utf8.test: adding test case heap/hp_hash.c: Bug#12891: UNION doesn't return DISTINCT result for multi-byte characters This piece of code was pretty wrong. mysql-test/t/ctype_utf8.test: adding test case mysql-test/r/ctype_utf8.result: adding test case
Diffstat (limited to 'heap')
-rw-r--r--heap/hp_hash.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/heap/hp_hash.c b/heap/hp_hash.c
index d643f776731..77f3cf6d80b 100644
--- a/heap/hp_hash.c
+++ b/heap/hp_hash.c
@@ -551,11 +551,13 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2,
}
if (cs->mbmaxlen > 1)
{
+ uint safe_length1= char_length1;
+ uint safe_length2= char_length2;
uint char_length= seg->length / cs->mbmaxlen;
- char_length1= my_charpos(cs, pos1, pos1 + char_length1, char_length1);
- set_if_smaller(char_length1, seg->length);
- char_length2= my_charpos(cs, pos2, pos2 + char_length2, char_length2);
- set_if_smaller(char_length2, seg->length);
+ char_length1= my_charpos(cs, pos1, pos1 + char_length1, char_length);
+ set_if_smaller(char_length1, safe_length1);
+ char_length2= my_charpos(cs, pos2, pos2 + char_length2, char_length);
+ set_if_smaller(char_length2, safe_length2);
}
if (cs->coll->strnncollsp(seg->charset,