MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:gluh Date:March 14 2006 2:39pm
Subject:bk commit into 5.1 tree (gluh:1.2169) BUG#18070
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of gluh. When gluh 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.2169 06/03/14 18:39:39 gluh@stripped +4 -0
  Bug#18053 Partitions: crash if null
  Bug#18070 Partitions: wrong result on WHERE ... IS NULL
    added handling of NULL values

  sql/sql_partition.cc
    1.45 06/03/14 18:37:49 gluh@stripped +0 -3
    Bug#18053 Partitions: crash if null
    Bug#18070 Partitions: wrong result on WHERE ... IS NULL
      removed unnecessary code

  sql/opt_range.cc
    1.206 06/03/14 18:37:49 gluh@stripped +6 -0
    Bug#18053 Partitions: crash if null
    Bug#18070 Partitions: wrong result on WHERE ... IS NULL
      added handling of NULL values

  mysql-test/t/partition.test
    1.20 06/03/14 18:37:49 gluh@stripped +29 -0
    Bug#18053 Partitions: crash if null
    Bug#18070 Partitions: wrong result on WHERE ... IS NULL
      test case

  mysql-test/r/partition.result
    1.17 06/03/14 18:37:49 gluh@stripped +30 -0
    Bug#18053 Partitions: crash if null
    Bug#18070 Partitions: wrong result on WHERE ... IS NULL
      test case

# 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:	gluh
# Host:	eagle.intranet.mysql.r18.ru
# Root:	/home/gluh/MySQL/Bugs/5.1.18070

--- 1.205/sql/opt_range.cc	Sat Feb 25 22:35:08 2006
+++ 1.206/sql/opt_range.cc	Tue Mar 14 18:37:49 2006
@@ -2708,6 +2708,12 @@ int find_used_partitions(PART_PRUNE_PARA
     if (-1 == (left_res= find_used_partitions(ppar,key_tree->left)))
       return -1;
   }
+  if (key_tree->maybe_null && ppar->part_info->has_null_value)
+  {
+    ppar->mark_full_partition_used(ppar->part_info, 
+                                   ppar->part_info->has_null_part_id);
+    goto process_next_key_part;
+  }
 
   if (key_tree->type == SEL_ARG::KEY_RANGE)
   {

--- 1.16/mysql-test/r/partition.result	Tue Mar  7 23:37:52 2006
+++ 1.17/mysql-test/r/partition.result	Tue Mar 14 18:37:49 2006
@@ -422,4 +422,34 @@ partition_name	partition_description	tab
 x123	11,12	1
 x234	NULL,1	1
 drop table t1;
+create table t1 (f1 integer) partition by range(f1)
+(partition p1 values less than (0), partition p2 values less than (10));
+insert into t1 set f1 = null;
+select * from t1 where f1 is null;
+f1
+NULL
+drop table t1;
+create table t1 (f1 integer) partition by list(f1)
+(partition p1 values in (1), partition p2 values in (null));
+insert into t1 set f1 = null;
+insert into t1 set f1 = 1;
+select * from t1 where f1 is null or f1 = 1;
+f1
+1
+NULL
+drop table t1;
+create table t1 (f1 smallint)
+partition by list (f1) (partition p0 values in (null));
+insert into t1 values (null);
+select * from t1 where f1 is null;
+f1
+NULL
+drop table t1;
+create table t1 (f1 smallint)
+partition by range (f1) (partition p0 values less than (0));
+insert into t1 values (null);
+select * from t1 where f1 is null;
+f1
+NULL
+drop table t1;
 End of 5.1 tests

--- 1.19/mysql-test/t/partition.test	Tue Mar  7 23:37:52 2006
+++ 1.20/mysql-test/t/partition.test	Tue Mar 14 18:37:49 2006
@@ -540,4 +540,33 @@ select partition_name, partition_descrip
 from information_schema.partitions where table_schema ='test';
 drop table t1;
 
+#
+# Bug#18053 Partitions: crash if null
+# Bug#18070 Partitions: wrong result on WHERE ... IS NULL
+#
+create table t1 (f1 integer) partition by range(f1)
+(partition p1 values less than (0), partition p2 values less than (10));
+insert into t1 set f1 = null;
+select * from t1 where f1 is null;
+drop table t1;
+
+create table t1 (f1 integer) partition by list(f1)
+(partition p1 values in (1), partition p2 values in (null));
+insert into t1 set f1 = null;
+insert into t1 set f1 = 1;
+select * from t1 where f1 is null or f1 = 1;
+drop table t1;
+
+create table t1 (f1 smallint)
+partition by list (f1) (partition p0 values in (null));
+insert into t1 values (null);
+select * from t1 where f1 is null;
+drop table t1;
+
+create table t1 (f1 smallint)
+partition by range (f1) (partition p0 values less than (0));
+insert into t1 values (null);
+select * from t1 where f1 is null;
+drop table t1;
+
 --echo End of 5.1 tests

--- 1.44/sql/sql_partition.cc	Fri Mar 10 05:37:53 2006
+++ 1.45/sql/sql_partition.cc	Tue Mar 14 18:37:49 2006
@@ -2853,9 +2853,6 @@ uint32 get_partition_id_range_for_endpoi
   /* Get the partitioning function value for the endpoint */
   longlong part_func_value= part_val_int(part_info->part_expr);
 
-  if (part_info->part_expr->null_value)
-    DBUG_RETURN(0);
-
   while (max_part_id > min_part_id)
   {
     loc_part_id= (max_part_id + min_part_id + 1) >> 1;
Thread
bk commit into 5.1 tree (gluh:1.2169) BUG#18070gluh14 Mar