Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

bk commit into 5.0 tree (ramil:1.2517) BUG#30885

From: <ramil(at)mysql.com>
Date: Fri Oct 05 2007 - 07:33:19 EDT


Below is the list of changes that have just been committed into a local 5.0 repository of ram. When ram 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.2517, 2007-10-05 16:33:15+05:00, ramil@mysql.com +3 -0   Fix for bug #30885: MEMORY returns incorrect data if BTREE index is used for NULL lookup   

  Problem: creating an rb-tree key we store length (2 bytes) before the actual data for   varchar key parts. The fact was missed for NULL key parts, when we set NULL byte and   skip the rest.   

  Fix: take into account the length of the varchar key parts for NULLs.

  heap/hp_hash.c@1.49, 2007-10-05 16:33:14+05:00, ramil@mysql.com +6 -0     Fix for bug #30885: MEMORY returns incorrect data if BTREE index is used for NULL lookup

  • skip varchar key parts length (2 byte) for null key parts.

  mysql-test/r/heap_btree.result@1.28, 2007-10-05 16:33:14+05:00, ramil@mysql.com +8 -0     Fix for bug #30885: MEMORY returns incorrect data if BTREE index is used for NULL lookup       -test result.

  mysql-test/t/heap_btree.test@1.25, 2007-10-05 16:33:14+05:00, ramil@mysql.com +9 -0     Fix for bug #30885: MEMORY returns incorrect data if BTREE index is used for NULL lookup

  • test case.

diff -Nrup a/heap/hp_hash.c b/heap/hp_hash.c
--- a/heap/hp_hash.c 2007-05-08 17:04:54 +05:00
+++ b/heap/hp_hash.c 2007-10-05 16:33:14 +05:00 @@ -808,6 +808,12 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, u

       if (!(*key++= (char) 1 - *old++))
       {
         k_len-= seg->length;
+        /* 
+          Take into account length (2 bytes) of varchar key parts 
+          stored before the data.
+         */
+        if (seg->flag & (HA_VAR_LENGTH_PART | HA_BLOB_PART))
+          k_len-= 2;
         continue;
       }
     }
diff -Nrup a/mysql-test/r/heap_btree.result b/mysql-test/r/heap_btree.result

--- a/mysql-test/r/heap_btree.result 2007-03-28 13:22:20 +05:00
+++ b/mysql-test/r/heap_btree.result 2007-10-05 16:33:14 +05:00
@@ -321,4 +321,12 @@ DROP TABLE t1;
 CREATE TABLE t1 (a INT, UNIQUE USING BTREE(a)) ENGINE=MEMORY;  INSERT INTO t1 VALUES(NULL),(NULL);
 DROP TABLE t1;
+create table t1(a varchar(255), b varchar(255), 
+key using btree (a,b)) engine=memory;
+insert into t1 values (1, 1), (3, 3), (2, 2), (NULL, 1), (NULL, NULL), (0, 0);
+select * from t1 where a is null;
+a	b
+NULL	NULL
+NULL	1
+drop table t1;

 End of 5.0 tests
diff -Nrup a/mysql-test/t/heap_btree.test b/mysql-test/t/heap_btree.test
--- a/mysql-test/t/heap_btree.test 2007-03-28 15:11:41 +05:00
+++ b/mysql-test/t/heap_btree.test 2007-10-05 16:33:14 +05:00 @@ -235,5 +235,14 @@ CREATE TABLE t1 (a INT, UNIQUE USING BTR  INSERT INTO t1 VALUES(NULL),(NULL);
 DROP TABLE t1;  
+#
+# Bug #30885: MEMORY returns incorrect data if BTREE index is used for NULL lookup
+#
+create table t1(a varchar(255), b varchar(255), 
+                key using btree (a,b)) engine=memory; 
+insert into t1 values (1, 1), (3, 3), (2, 2), (NULL, 1), (NULL, NULL), (0, 0);
+select * from t1 where a is null;
+drop table t1;
+

 --echo End of 5.0 tests  
-- 
MySQL Code Commits Mailing List
For list archives: 
http://lists.mysql.com/commits
To unsubscribe:    
http://lists.mysql.com/commits?unsub=lists@pantek.com
Received on Fri Oct 5 07:33:42 2007
Do you need help?X

This archive was generated by hypermail 2.1.8 : Sun Oct 07 2007 - 09:57:49 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library