Commit 255d8ef3 authored by unknown's avatar unknown

Merge moonbone.local:/mnt/gentoo64/work/23656-bug-4.1-opt-mysql

into  moonbone.local:/mnt/gentoo64/work/23656-bug-5.0-opt-mysql


mysql-test/r/cast.result:
  Auto merged
mysql-test/t/cast.test:
  Auto merged
sql/item_func.cc:
  Manual merge
parents 57fb3374 4fd339b2
......@@ -351,6 +351,12 @@ DROP TABLE t1;
select isnull(date(NULL)), isnull(cast(NULL as DATE));
isnull(date(NULL)) isnull(cast(NULL as DATE))
1 1
SELECT CAST(cast('01-01-01' as date) AS UNSIGNED);
CAST(cast('01-01-01' as date) AS UNSIGNED)
20010101
SELECT CAST(cast('01-01-01' as date) AS SIGNED);
CAST(cast('01-01-01' as date) AS SIGNED)
20010101
End of 4.1 tests
select cast('1.2' as decimal(3,2));
cast('1.2' as decimal(3,2))
......
......@@ -182,6 +182,12 @@ DROP TABLE t1;
select isnull(date(NULL)), isnull(cast(NULL as DATE));
#
# Bug#23656: Wrong result of CAST from DATE to int
#
SELECT CAST(cast('01-01-01' as date) AS UNSIGNED);
SELECT CAST(cast('01-01-01' as date) AS SIGNED);
--echo End of 4.1 tests
......
......@@ -947,7 +947,8 @@ longlong Item_func_signed::val_int()
longlong value;
int error;
if (args[0]->cast_to_int_type() != STRING_RESULT)
if (args[0]->cast_to_int_type() != STRING_RESULT ||
args[0]->result_as_longlong())
{
value= args[0]->val_int();
null_value= args[0]->null_value;
......@@ -986,7 +987,8 @@ longlong Item_func_unsigned::val_int()
my_decimal2int(E_DEC_FATAL_ERROR, dec, 1, &value);
return value;
}
else if (args[0]->cast_to_int_type() != STRING_RESULT)
else if (args[0]->cast_to_int_type() != STRING_RESULT ||
args[0]->result_as_longlong())
{
value= args[0]->val_int();
null_value= args[0]->null_value;
......
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