Commit c0c56d13 authored by unknown's avatar unknown

Merge bk@192.168.21.1:mysql-5.0-opt

into  mysql.com:/home/hf/work/8663/my50-8663


sql/item_func.cc:
  Auto merged
parents 0e69c252 f00e6bd7
...@@ -1412,3 +1412,8 @@ i2 count(distinct j) ...@@ -1412,3 +1412,8 @@ i2 count(distinct j)
1.0 2 1.0 2
2.0 2 2.0 2
drop table t1; drop table t1;
select cast(19999999999999999999 as unsigned);
cast(19999999999999999999 as unsigned)
18446744073709551615
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
...@@ -1108,3 +1108,9 @@ insert into t1 values (1,1), (1,2), (2,3), (2,4); ...@@ -1108,3 +1108,9 @@ insert into t1 values (1,1), (1,2), (2,3), (2,4);
select i, count(distinct j) from t1 group by i; select i, count(distinct j) from t1 group by i;
select i+0.0 as i2, count(distinct j) from t1 group by i2; select i+0.0 as i2, count(distinct j) from t1 group by i2;
drop table t1; drop table t1;
#
# Bug #8663 (cant use bigint as input to CAST)
#
select cast(19999999999999999999 as unsigned);
...@@ -964,7 +964,14 @@ longlong Item_func_unsigned::val_int() ...@@ -964,7 +964,14 @@ longlong Item_func_unsigned::val_int()
longlong value; longlong value;
int error; int error;
if (args[0]->cast_to_int_type() != STRING_RESULT) if (args[0]->cast_to_int_type() == DECIMAL_RESULT)
{
my_decimal tmp, *dec= args[0]->val_decimal(&tmp);
if (!(null_value= args[0]->null_value))
my_decimal2int(E_DEC_FATAL_ERROR, dec, 1, &value);
return value;
}
else if (args[0]->cast_to_int_type() != STRING_RESULT)
{ {
value= args[0]->val_int(); value= args[0]->val_int();
null_value= args[0]->null_value; null_value= args[0]->null_value;
......
...@@ -1036,7 +1036,7 @@ int decimal2ulonglong(decimal_t *from, ulonglong *to) ...@@ -1036,7 +1036,7 @@ int decimal2ulonglong(decimal_t *from, ulonglong *to)
x=x*DIG_BASE + *buf++; x=x*DIG_BASE + *buf++;
if (unlikely(y > ((ulonglong) ULONGLONG_MAX/DIG_BASE) || x < y)) if (unlikely(y > ((ulonglong) ULONGLONG_MAX/DIG_BASE) || x < y))
{ {
*to=y; *to=ULONGLONG_MAX;
return E_DEC_OVERFLOW; return E_DEC_OVERFLOW;
} }
} }
......
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