Commit e5f30744 authored by Mikael Ronstrom's avatar Mikael Ronstrom

Fixed sql_mode issue in BUG#48164, will ignore sql_mode when generating...

Fixed sql_mode issue in BUG#48164, will ignore sql_mode when generating constants, also warnings will not be tolerated
parent 167557fe
drop table if exists t1;
set @@sql_mode=allow_invalid_dates;
create table t1 (a char, b char, c date)
partition by range column_list (a,b,c)
( partition p0 values less than (0,0,to_days('3000-11-31')));
ERROR HY000: Partition column values of incorrect type
create table t1 (a char, b char, c date)
partition by range column_list (a,b,c)
( partition p0 values less than (0,0,'3000-11-31'));
ERROR HY000: Partition column values of incorrect type
set @@sql_mode='';
create table t1 (a varchar(2) character set ucs2)
partition by list column_list (a)
(partition p0 values in (0x2020),
......
......@@ -8,6 +8,21 @@
drop table if exists t1;
--enable_warnings
#
# BUG#48165, sql_mode gives error
#
set @@sql_mode=allow_invalid_dates;
--error ER_WRONG_TYPE_COLUMN_VALUE_ERROR
create table t1 (a char, b char, c date)
partition by range column_list (a,b,c)
( partition p0 values less than (0,0,to_days('3000-11-31')));
--error ER_WRONG_TYPE_COLUMN_VALUE_ERROR
create table t1 (a char, b char, c date)
partition by range column_list (a,b,c)
( partition p0 values less than (0,0,'3000-11-31'));
set @@sql_mode='';
#
# BUG#48163, Dagger in UCS2 not working as partition value
#
......
......@@ -1949,18 +1949,28 @@ bool partition_info::fix_column_value_functions(THD *thd,
{
uchar *val_ptr;
uint len= field->pack_length();
ulong save_sql_mode;
bool save_got_warning;
if (!(column_item= get_column_item(column_item,
field)))
{
result= TRUE;
goto end;
}
if (column_item->save_in_field(field, TRUE))
save_sql_mode= thd->variables.sql_mode;
thd->variables.sql_mode= 0;
save_got_warning= thd->got_warning;
thd->got_warning= 0;
if (column_item->save_in_field(field, TRUE) ||
thd->got_warning)
{
my_error(ER_WRONG_TYPE_COLUMN_VALUE_ERROR, MYF(0));
result= TRUE;
goto end;
}
thd->got_warning= save_got_warning;
thd->variables.sql_mode= save_sql_mode;
if (!(val_ptr= (uchar*) sql_calloc(len)))
{
mem_alloc_error(len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment