Below is the list of changes that have just been committed into a local
5.1 repository of reggie. When reggie 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.2146 06/03/07 13:38:03 reggie@stripped +5 -0
Merge rburnett@stripped:/home/bk/mysql-5.1-new
into linux.site:/home/reggie/work/mysql-5.1
client/mysqltest.c
1.197 06/03/07 13:37:52 reggie@stripped +0 -0
Auto merged
sql/sql_partition.cc
1.43 06/03/07 13:37:53 reggie@stripped +1 -1
Auto merged
sql/ha_partition.cc
1.36 06/03/07 13:37:52 reggie@stripped +0 -0
Auto merged
mysql-test/t/partition.test
1.19 06/03/07 13:37:52 reggie@stripped +0 -0
Auto merged
mysql-test/r/partition.result
1.16 06/03/07 13:37:52 reggie@stripped +0 -0
Auto merged
# 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: reggie
# Host: linux.site
# Root: /home/reggie/work/mysql-5.1/RESYNC
--- 1.18/mysql-test/t/partition.test 2006-03-03 08:11:32 -06:00
+++ 1.19/mysql-test/t/partition.test 2006-03-07 13:37:52 -06:00
@@ -483,4 +483,61 @@
drop table t1//
delimiter ;//
+#
+# Bug #15447 Partitions: NULL is treated as zero
+#
+
+# NULL for RANGE partition
+create table t1 (a int,b int,c int,key(a,b))
+partition by range (a)
+partitions 3
+(partition x1 values less than (0) tablespace ts1,
+ partition x2 values less than (10) tablespace ts2,
+ partition x3 values less than maxvalue tablespace ts3);
+
+insert into t1 values (NULL, 1, 1);
+insert into t1 values (0, 1, 1);
+insert into t1 values (12, 1, 1);
+
+select partition_name, partition_description, table_rows
+from information_schema.partitions where table_schema ='test';
+drop table t1;
+
+# NULL for LIST partition
+--error 1473
+create table t1 (a int,b int, c int)
+partition by list(a)
+partitions 2
+(partition x123 values in (11,12),
+ partition x234 values in (1 ,NULL, NULL));
+
+--error 1473
+create table t1 (a int,b int, c int)
+partition by list(a)
+partitions 2
+(partition x123 values in (11, NULL),
+ partition x234 values in (1 ,NULL));
+
+create table t1 (a int,b int, c int)
+partition by list(a)
+partitions 2
+(partition x123 values in (11, 12),
+ partition x234 values in (5, 1));
+--error 1504
+insert into t1 values (NULL,1,1);
+drop table t1;
+
+create table t1 (a int,b int, c int)
+partition by list(a)
+partitions 2
+(partition x123 values in (11, 12),
+ partition x234 values in (NULL, 1));
+
+insert into t1 values (11,1,6);
+insert into t1 values (NULL,1,1);
+
+select partition_name, partition_description, table_rows
+from information_schema.partitions where table_schema ='test';
+drop table t1;
+
--echo End of 5.1 tests
--- 1.35/sql/ha_partition.cc 2006-03-06 23:18:41 -06:00
+++ 1.36/sql/ha_partition.cc 2006-03-07 13:37:52 -06:00
@@ -5127,6 +5127,7 @@
{
char buf[100];
my_error(ER_NO_PARTITION_FOR_GIVEN_VALUE, MYF(0),
+ m_part_info->part_expr->null_value ? "NULL" :
llstr(m_part_info->part_expr->val_int(), buf));
}
else
--- 1.42/sql/sql_partition.cc 2006-03-03 08:11:33 -06:00
+++ 1.43/sql/sql_partition.cc 2006-03-07 13:37:53 -06:00
@@ -531,6 +531,7 @@
bool result= TRUE;
longlong curr_value, prev_value;
partition_element* part_def;
+ bool found_null= FALSE;
List_iterator<partition_element> list_func_it(part_info->partitions);
DBUG_ENTER("check_list_constants");
@@ -556,6 +557,17 @@
do
{
part_def= list_func_it++;
+ if (part_def->has_null_value)
+ {
+ if (found_null)
+ {
+ my_error(ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR, MYF(0));
+ goto end;
+ }
+ part_info->has_null_value= TRUE;
+ part_info->has_null_part_id= i;
+ found_null= TRUE;
+ }
List_iterator<longlong> list_val_it1(part_def->list_val_list);
while (list_val_it1++)
no_list_values++;
@@ -2041,6 +2053,16 @@
err+= add_string(fptr, "VALUES IN ");
uint no_items= p_elem->list_val_list.elements;
err+= add_begin_parenthesis(fptr);
+ if (p_elem->has_null_value)
+ {
+ err+= add_string(fptr, "NULL");
+ if (no_items == 0)
+ {
+ err+= add_end_parenthesis(fptr);
+ goto end;
+ }
+ err+= add_comma(fptr);
+ }
i= 0;
do
{
@@ -2051,6 +2073,7 @@
} while (++i < no_items);
err+= add_end_parenthesis(fptr);
}
+end:
return err + add_space(fptr);
}
@@ -2631,6 +2654,15 @@
longlong part_func_value= part_val_int(part_info->part_expr);
DBUG_ENTER("get_partition_id_list");
+ if (part_info->part_expr->null_value)
+ {
+ if (part_info->has_null_value)
+ {
+ *part_id= part_info->has_null_part_id;
+ DBUG_RETURN(0);
+ }
+ goto notfound;
+ }
*func_value= part_func_value;
while (max_list_index >= min_list_index)
{
@@ -2741,6 +2773,11 @@
longlong part_func_value= part_val_int(part_info->part_expr);
DBUG_ENTER("get_partition_id_int_range");
+ if (part_info->part_expr->null_value)
+ {
+ *part_id= 0;
+ DBUG_RETURN(0);
+ }
while (max_part_id > min_part_id)
{
loc_part_id= (max_part_id + min_part_id + 1) >> 1;
@@ -2814,6 +2851,10 @@
uint min_part_id= 0, max_part_id= max_partition, loc_part_id;
/* 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;
--- 1.196/client/mysqltest.c 2006-03-07 14:52:46 -06:00
+++ 1.197/client/mysqltest.c 2006-03-07 13:37:52 -06:00
@@ -3787,6 +3787,7 @@
{
const char** pattern= dynamic_element(&patterns, i, const char**);
DBUG_PRINT("info", ("pattern: %s", *pattern));
+ if (strlen(*pattern) == 0) continue;
/* Search for the path in string */
while ((p= strstr(val, *pattern)))
{
| Thread |
|---|
| • bk commit into 5.1 tree (reggie:1.2146) | reggie | 7 Mar |