#At file:///home/mikael/mysql_clones/mysql-next-wl3352/
2914 Mikael Ronstrom 2009-10-30
Fixed such that we fail if using integer constants for character set fields, now need to have correct constant types
modified:
mysql-test/r/partition_column.result
mysql-test/t/partition_column.test
sql/sql_partition.cc
=== modified file 'mysql-test/r/partition_column.result'
--- a/mysql-test/r/partition_column.result 2009-10-30 20:08:34 +0000
+++ b/mysql-test/r/partition_column.result 2009-10-30 20:44:41 +0000
@@ -39,6 +39,15 @@ subpartitions 4
partition p1 values less than (1, 'a', MAXVALUE, '1999-01-01'),
partition p2 values less than (1, 'a', MAXVALUE, MAXVALUE),
partition p3 values less than (1, MAXVALUE, MAXVALUE, MAXVALUE));
+ERROR HY000: Partition column values of incorrect type
+create table t1 (a int, b char(10), c varchar(25), d datetime)
+partition by range columns(a,b,c,d)
+subpartition by hash (to_seconds(d))
+subpartitions 4
+( partition p0 values less than (1, '0', MAXVALUE, '1900-01-01'),
+partition p1 values less than (1, 'a', MAXVALUE, '1999-01-01'),
+partition p2 values less than (1, 'a', MAXVALUE, MAXVALUE),
+partition p3 values less than (1, MAXVALUE, MAXVALUE, MAXVALUE));
select partition_method, partition_expression, partition_description
from information_schema.partitions where table_name = "t1";
partition_method partition_expression partition_description
@@ -421,7 +430,7 @@ create table t1 (a char(6))
partition by range columns(a)
(partition p0 values less than (23456),
partition p1 values less than (23456));
-ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partition
+ERROR HY000: Partition column values of incorrect type
create table t1 (a int, b int)
partition by range columns(a,b)
(partition p0 values less than (10));
=== modified file 'mysql-test/t/partition_column.test'
--- a/mysql-test/t/partition_column.test 2009-10-30 20:08:34 +0000
+++ b/mysql-test/t/partition_column.test 2009-10-30 20:44:41 +0000
@@ -51,6 +51,7 @@ insert into t1 values ('');
insert into t1 values (_ucs2 0x2020);
drop table t1;
+--error ER_WRONG_TYPE_COLUMN_VALUE_ERROR
create table t1 (a int, b char(10), c varchar(25), d datetime)
partition by range columns(a,b,c,d)
subpartition by hash (to_seconds(d))
@@ -59,6 +60,15 @@ subpartitions 4
partition p1 values less than (1, 'a', MAXVALUE, '1999-01-01'),
partition p2 values less than (1, 'a', MAXVALUE, MAXVALUE),
partition p3 values less than (1, MAXVALUE, MAXVALUE, MAXVALUE));
+
+create table t1 (a int, b char(10), c varchar(25), d datetime)
+partition by range columns(a,b,c,d)
+subpartition by hash (to_seconds(d))
+subpartitions 4
+( partition p0 values less than (1, '0', MAXVALUE, '1900-01-01'),
+ partition p1 values less than (1, 'a', MAXVALUE, '1999-01-01'),
+ partition p2 values less than (1, 'a', MAXVALUE, MAXVALUE),
+ partition p3 values less than (1, MAXVALUE, MAXVALUE, MAXVALUE));
select partition_method, partition_expression, partition_description
from information_schema.partitions where table_name = "t1";
show create table t1;
@@ -310,7 +320,7 @@ partition by range columns(a)
(partition p0 values less than (H23456),
partition p1 values less than (M23456));
--- error ER_RANGE_NOT_INCREASING_ERROR
+-- error ER_WRONG_TYPE_COLUMN_VALUE_ERROR
create table t1 (a char(6))
partition by range columns(a)
(partition p0 values less than (23456),
=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc 2009-10-30 20:08:34 +0000
+++ b/sql/sql_partition.cc 2009-10-30 20:44:41 +0000
@@ -2240,6 +2240,11 @@ static int add_column_list_values(File f
else
field_cs= NULL;
}
+ if (result_type != item_expr->result_type())
+ {
+ my_error(ER_WRONG_TYPE_COLUMN_VALUE_ERROR, MYF(0));
+ return 1;
+ }
if (field_cs && field_cs != item_expr->collation.collation)
{
if (!(item_expr= convert_charset_partition_constant(item_expr,
@@ -2249,11 +2254,6 @@ static int add_column_list_values(File f
return 1;
}
}
- if (result_type != item_expr->result_type())
- {
- my_error(ER_WRONG_TYPE_COLUMN_VALUE_ERROR, MYF(0));
- return 1;
- }
{
String val_conv;
res= item_expr->val_str(&str);
| Thread |
|---|
| • bzr commit into mysql-5.5-next-mr branch (mikael:2914) | Mikael Ronstrom | 30 Oct |