List:Commits« Previous MessageNext Message »
From:Sergey Vojtovich Date:May 10 2006 4:50pm
Subject:bk commit into 5.0 tree (svoj:1.2117) BUG#18233
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of svoj. When svoj 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.2117 06/05/10 21:50:04 svoj@april.(none) +3 -0
  BUG#18233 - Memory tables INDEX USING HASH (a,b) returns 1 row on
              SELECT WHERE a= AND b=
  
  Selecting data from memory table with varchar column and hash index over it
  returns only first row matched.
  
  Problem was that key length calculation for varchar columns didn't include
  number of bytes to store length.
  
  Fixed key length for varchar fields to include number of bytes to store length.

  mysql-test/t/heap.test
    1.35 06/05/10 21:50:00 svoj@april.(none) +12 -0
    Testcase for BUG#18233.

  mysql-test/r/heap.result
    1.49 06/05/10 21:50:00 svoj@april.(none) +13 -0
    Testcase for BUG#18233.

  heap/hp_create.c
    1.23 06/05/10 21:50:00 svoj@april.(none) +2 -0
    Fixed key length for varchar fields to include number of bytes to store length.

# 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:	svoj
# Host:	april.(none)
# Root:	/home/svoj/devel/mysql/BUG18233/mysql-5.0

--- 1.22/heap/hp_create.c	2006-02-02 18:25:21 +04:00
+++ 1.23/heap/hp_create.c	2006-05-10 21:50:00 +05:00
@@ -85,6 +85,7 @@
           if (!my_binary_compare(keyinfo->seg[j].charset))
             keyinfo->flag|= HA_END_SPACE_KEY;
           keyinfo->flag|= HA_VAR_LENGTH_KEY;
+          length+= 2;
           /* Save number of bytes used to store length */
           keyinfo->seg[j].bit_start= 1;
           break;
@@ -95,6 +96,7 @@
           if (!my_binary_compare(keyinfo->seg[j].charset))
             keyinfo->flag|= HA_END_SPACE_KEY;
           keyinfo->flag|= HA_VAR_LENGTH_KEY;
+          length+= 2;
           /* Save number of bytes used to store length */
           keyinfo->seg[j].bit_start= 2;
           /*

--- 1.48/mysql-test/r/heap.result	2006-03-05 01:59:37 +04:00
+++ 1.49/mysql-test/r/heap.result	2006-05-10 21:50:00 +05:00
@@ -718,3 +718,16 @@
 t1	MEMORY	10	Fixed	0	11	0	#	0	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
 t2	MEMORY	10	Fixed	0	12	0	#	0	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
 drop table t1, t2;
+CREATE TABLE t1(a VARCHAR(1), b VARCHAR(2), c VARCHAR(256),
+KEY(a), KEY(b), KEY(c)) ENGINE=MEMORY;
+INSERT INTO t1 VALUES('a','aa',REPEAT('a', 256)),('a','aa',REPEAT('a',256));
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE b='aa';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE c=REPEAT('a',256);
+COUNT(*)
+2
+DROP TABLE t1;

--- 1.34/mysql-test/t/heap.test	2006-03-05 01:58:39 +04:00
+++ 1.35/mysql-test/t/heap.test	2006-05-10 21:50:00 +05:00
@@ -458,4 +458,16 @@
 show table status like 't_';
 drop table t1, t2;
 
+#
+# BUG#18233 - Memory tables INDEX USING HASH (a,b) returns 1 row on
+#             SELECT WHERE a= AND b=
+#
+CREATE TABLE t1(a VARCHAR(1), b VARCHAR(2), c VARCHAR(256),
+                KEY(a), KEY(b), KEY(c)) ENGINE=MEMORY;
+INSERT INTO t1 VALUES('a','aa',REPEAT('a', 256)),('a','aa',REPEAT('a',256));
+SELECT COUNT(*) FROM t1 WHERE a='a';
+SELECT COUNT(*) FROM t1 WHERE b='aa';
+SELECT COUNT(*) FROM t1 WHERE c=REPEAT('a',256);
+DROP TABLE t1;
+
 # End of 5.0 tests
Thread
bk commit into 5.0 tree (svoj:1.2117) BUG#18233Sergey Vojtovich10 May