Bug #59498 div function broken in mysql-trunk
This commit is contained in:
parent
43a2f80e16
commit
02d7b27641
@ -650,3 +650,9 @@ SELECT ((@a:=@b:=1.0) div (@b:=@a:=get_format(datetime, 'usa')));
|
|||||||
NULL
|
NULL
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1366 Incorrect decimal value: '' for column '' at row -1
|
Warning 1366 Incorrect decimal value: '' for column '' at row -1
|
||||||
|
#
|
||||||
|
# Bug #59498 div function broken in mysql-trunk
|
||||||
|
#
|
||||||
|
SELECT 1 div null;
|
||||||
|
1 div null
|
||||||
|
NULL
|
||||||
|
@ -495,3 +495,8 @@ DROP TABLE t1;
|
|||||||
--echo # in do_div_mod with doubly assigned variables
|
--echo # in do_div_mod with doubly assigned variables
|
||||||
--echo #
|
--echo #
|
||||||
SELECT ((@a:=@b:=1.0) div (@b:=@a:=get_format(datetime, 'usa')));
|
SELECT ((@a:=@b:=1.0) div (@b:=@a:=get_format(datetime, 'usa')));
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug #59498 div function broken in mysql-trunk
|
||||||
|
--echo #
|
||||||
|
SELECT 1 div null;
|
||||||
|
@ -1582,10 +1582,15 @@ longlong Item_func_int_div::val_int()
|
|||||||
args[1]->result_type() != INT_RESULT)
|
args[1]->result_type() != INT_RESULT)
|
||||||
{
|
{
|
||||||
my_decimal tmp;
|
my_decimal tmp;
|
||||||
my_decimal val0= *args[0]->val_decimal(&tmp);
|
my_decimal *val0p= args[0]->val_decimal(&tmp);
|
||||||
my_decimal val1= *args[1]->val_decimal(&tmp);
|
if ((null_value= args[0]->null_value))
|
||||||
if ((null_value= (args[0]->null_value || args[1]->null_value)))
|
|
||||||
return 0;
|
return 0;
|
||||||
|
my_decimal val0= *val0p;
|
||||||
|
|
||||||
|
my_decimal *val1p= args[1]->val_decimal(&tmp);
|
||||||
|
if ((null_value= args[1]->null_value))
|
||||||
|
return 0;
|
||||||
|
my_decimal val1= *val1p;
|
||||||
|
|
||||||
int err;
|
int err;
|
||||||
if ((err= my_decimal_div(E_DEC_FATAL_ERROR & ~E_DEC_DIV_ZERO, &tmp,
|
if ((err= my_decimal_div(E_DEC_FATAL_ERROR & ~E_DEC_DIV_ZERO, &tmp,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user