List:Internals« Previous MessageNext Message »
From:igor Date:July 8 2005 11:12am
Subject:bk commit into 5.0 tree (igor:1.1891) BUG#11484
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of igor. When igor does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1891 05/07/08 02:12:31 igor@stripped +3 -0
  ctype_utf8.test:
    Added a test case for bug #11484.
  hp_hash.c:
    Fixed bug #11484.
    This bug in the function hp_rec_key_cmp resulted in wrong
    comparison of varchar multibyte keys if the bytes after 
    string values happened to be different. This caused wrong
    results for queries returning DISTINCT varchar fields in
    multibyte charsets (e.g. in utf8).

  mysql-test/r/ctype_utf8.result
    1.64 05/07/08 02:12:10 igor@stripped +19 -0

  mysql-test/t/ctype_utf8.test
    1.58 05/07/08 02:11:22 igor@stripped +13 -0
    Added a test case for bug #11484.

  heap/hp_hash.c
    1.42 05/07/08 02:04:24 igor@stripped +2 -2
    Fixed bug #11484.
    This bug in the function hp_rec_key_cmp resulted in wrong
    comparison of varchar multibyte keys if the bytes after 
    string values happened to be different. This caused wrong
    results for queries returning DISTINCT varchar fields in
    multibyte charsets (e.g. in utf8).

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	igor
# Host:	igor-inspiron.creware.com
# Root:	/home/igor/dev/mysql-5.0-0

--- 1.41/heap/hp_hash.c	Mon Jun 13 03:41:06 2005
+++ 1.42/heap/hp_hash.c	Fri Jul  8 02:04:24 2005
@@ -552,9 +552,9 @@
       if (cs->mbmaxlen > 1)
       {
         uint char_length= seg->length / cs->mbmaxlen;
-        char_length1= my_charpos(cs, pos1, pos1 + char_length1, char_length);
+        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_length);
+        char_length2= my_charpos(cs, pos2, pos2 + char_length2, char_length2);
         set_if_smaller(char_length2, seg->length);
       }
 

--- 1.63/mysql-test/r/ctype_utf8.result	Sun Jul  3 02:32:01 2005
+++ 1.64/mysql-test/r/ctype_utf8.result	Fri Jul  8 02:12:10 2005
@@ -950,3 +950,22 @@
 5B
 E880BD
 drop table t1;
+CREATE TABLE t1(id varchar(20) NOT NULL) DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES ('xxx'), ('aa'), ('yyy'), ('aa');
+SELECT id FROM t1;
+id
+xxx
+aa
+yyy
+aa
+SELECT DISTINCT id FROM t1;
+id
+xxx
+aa
+yyy
+SELECT DISTINCT id FROM t1 ORDER BY id;
+id
+aa
+xxx
+yyy
+DROP TABLE t1;

--- 1.57/mysql-test/t/ctype_utf8.test	Tue Jun 28 02:59:04 2005
+++ 1.58/mysql-test/t/ctype_utf8.test	Fri Jul  8 02:11:22 2005
@@ -800,3 +800,16 @@
 insert into t1 values (_utf8 0x5b);
 select hex(a) from t1;
 drop table t1;
+
+#
+# Test for bug #11484: wrong results for a DISTINCT varchar column in uft8. 
+#
+
+CREATE TABLE t1(id varchar(20) NOT NULL) DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES ('xxx'), ('aa'), ('yyy'), ('aa');
+
+SELECT id FROM t1;
+SELECT DISTINCT id FROM t1;
+SELECT DISTINCT id FROM t1 ORDER BY id;
+
+DROP TABLE t1;
Thread
bk commit into 5.0 tree (igor:1.1891) BUG#11484igor8 Jul