mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
Fixed such that we fail if using integer constants for character set fields, now need to have correct constant types
This commit is contained in:
parent
319e843509
commit
cf8fddb910
3 changed files with 26 additions and 7 deletions
|
@ -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));
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -2240,6 +2240,11 @@ static int add_column_list_values(File fptr, partition_info *part_info,
|
|||
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 fptr, partition_info *part_info,
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue