mirror of
https://github.com/MariaDB/server.git
synced 2025-02-17 19:05:37 +01:00
Merge mysql.com:/home/hf/work/8663/my50-8663
into mysql.com:/home/hf/work/8663/my51-8663
This commit is contained in:
commit
7e1c6b480d
4 changed files with 19 additions and 2 deletions
|
@ -1449,3 +1449,8 @@ Error 1264 Out of range value for column 'cast(-13.4 as decimal(2,1))' at row 1
|
||||||
select cast(98.6 as decimal(2,0));
|
select cast(98.6 as decimal(2,0));
|
||||||
cast(98.6 as decimal(2,0))
|
cast(98.6 as decimal(2,0))
|
||||||
99
|
99
|
||||||
|
select cast(19999999999999999999 as unsigned);
|
||||||
|
cast(19999999999999999999 as unsigned)
|
||||||
|
18446744073709551615
|
||||||
|
Warnings:
|
||||||
|
Error 1292 Truncated incorrect DECIMAL value: ''
|
||||||
|
|
|
@ -1130,3 +1130,8 @@ select cast(-3.4 as decimal(2,1));
|
||||||
select cast(99.6 as decimal(2,0));
|
select cast(99.6 as decimal(2,0));
|
||||||
select cast(-13.4 as decimal(2,1));
|
select cast(-13.4 as decimal(2,1));
|
||||||
select cast(98.6 as decimal(2,0));
|
select cast(98.6 as decimal(2,0));
|
||||||
|
|
||||||
|
# Bug #8663 (cant use bigint as input to CAST)
|
||||||
|
#
|
||||||
|
select cast(19999999999999999999 as unsigned);
|
||||||
|
|
||||||
|
|
|
@ -961,7 +961,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;
|
||||||
|
|
|
@ -1042,7 +1042,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue