MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Mikael Ronstrom Date:October 6 2009 2:23pm
Subject:bzr push into mysql-5.4 branch (mikael:2884 to 2886) Bug#47838
View as plain text  
 2886 Mikael Ronstrom	2009-10-06
      BUG#47838, NULL values in ranges was dropped due to missing else part in store_tuple_to_record, added more tests
      modified:
        mysql-test/r/partition_column.result

 2885 Mikael Ronstrom	2009-10-06
      BUG#47838, NULL values in ranges was dropped due to missing else part in store_tuple_to_record
      modified:
        mysql-test/r/partition_column.result
        mysql-test/t/partition_column.test
        sql/sql_partition.cc

 2884 Mikael Ronstrom	2009-10-05
      BUG#47776, Fixed character set handling, used wrong length, eventually also found that didn't need to convert to my_strnxfrm-format for column list partitioned tables, also column list partitioned tables can use multi-byte character sets in partition fields as well as where strxfrm multiplies the number of bytes in the string
      modified:
        mysql-test/r/partition_innodb.result
        mysql-test/t/partition_innodb.test
        sql/sql_partition.cc

=== modified file 'mysql-test/r/partition_column.result'
--- a/mysql-test/r/partition_column.result	2009-10-02 09:31:05 +0000
+++ b/mysql-test/r/partition_column.result	2009-10-06 14:22:54 +0000
@@ -1,4 +1,42 @@
 drop table if exists t1;
+create table t1 (a int signed)
+partition by list (a)
+( partition p0 values in (1, 3, 5, 7, 9, NULL),
+partition p1 values in (2, 4, 6, 8, 0));
+insert into t1 values (NULL),(0),(1),(2),(2),(4),(4),(4),(8),(8);
+select * from t1 where NULL <= a;
+a
+select * from t1 where a is null;
+a
+NULL
+explain partitions select * from t1 where a is null;
+id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	10	Using where
+select * from t1 where a <= 1;
+a
+1
+0
+drop table t1;
+create table t1 (a int signed)
+partition by list column_list(a)
+( partition p0 values in (column_list(1), column_list(3), column_list(5),
+column_list(7), column_list(9), column_list(NULL)),
+partition p1 values in (column_list(2), column_list(4), column_list(6),
+column_list(8), column_list(0)));
+insert into t1 values (NULL),(0),(1),(2),(2),(4),(4),(4),(8),(8);
+select * from t1 where a <= NULL;
+a
+select * from t1 where a is null;
+a
+NULL
+explain partitions select * from t1 where a is null;
+id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	2	Using where
+select * from t1 where a <= 1;
+a
+1
+0
+drop table t1;
 create table t1 (a int, b int)
 partition by list column_list(a,b)
 ( partition p0 values in (column_list(1, NULL), column_list(2, NULL),

=== modified file 'mysql-test/t/partition_column.test'
--- a/mysql-test/t/partition_column.test	2009-10-02 09:31:05 +0000
+++ b/mysql-test/t/partition_column.test	2009-10-06 14:22:15 +0000
@@ -8,6 +8,33 @@
 drop table if exists t1;
 --enable_warnings
 
+#
+# BUG#47838, List partitioning have problems with <= and >=
+#
+create table t1 (a int signed)
+partition by list (a)
+( partition p0 values in (1, 3, 5, 7, 9, NULL),
+  partition p1 values in (2, 4, 6, 8, 0));
+insert into t1 values (NULL),(0),(1),(2),(2),(4),(4),(4),(8),(8);
+select * from t1 where NULL <= a;
+select * from t1 where a is null;
+explain partitions select * from t1 where a is null;
+select * from t1 where a <= 1;
+drop table t1;
+
+create table t1 (a int signed)
+partition by list column_list(a)
+( partition p0 values in (column_list(1), column_list(3), column_list(5),
+                          column_list(7), column_list(9), column_list(NULL)),
+  partition p1 values in (column_list(2), column_list(4), column_list(6),
+                          column_list(8), column_list(0)));
+insert into t1 values (NULL),(0),(1),(2),(2),(4),(4),(4),(8),(8);
+select * from t1 where a <= NULL;
+select * from t1 where a is null;
+explain partitions select * from t1 where a is null;
+select * from t1 where a <= 1;
+drop table t1;
+
 create table t1 (a int, b int)
 partition by list column_list(a,b)
 ( partition p0 values in (column_list(1, NULL), column_list(2, NULL),

=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc	2009-10-05 14:10:18 +0000
+++ b/sql/sql_partition.cc	2009-10-06 14:22:15 +0000
@@ -6761,10 +6761,9 @@ uint32 store_tuple_to_record(Field **pfi
     if ((*pfield)->real_maybe_null())
     {
       if (*loc_value)
-      {
         (*pfield)->set_null();
-      }
-      (*pfield)->set_notnull();
+      else
+        (*pfield)->set_notnull();
       loc_value++;
     }
     uint len= (*pfield)->pack_length();
@@ -6950,12 +6949,16 @@ int get_part_iter_for_interval_cols_via_
     get_col_endpoint= get_partition_id_cols_range_for_endpoint;
     part_iter->get_next= get_next_partition_id_range;
   }
-  else
+  else if (part_info->part_type == LIST_PARTITION)
   {
     get_col_endpoint= get_partition_id_cols_list_for_endpoint;
     part_iter->get_next= get_next_partition_id_list;
     part_iter->part_info= part_info;
+    DBUG_ASSERT(part_info->num_list_values);
   }
+  else
+    assert(0);
+
   if (flags & NO_MIN_RANGE)
     part_iter->part_nums.start= part_iter->part_nums.cur= 0;
   else

Thread
bzr push into mysql-5.4 branch (mikael:2884 to 2886) Bug#47838Mikael Ronstrom6 Oct