mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Fixed BUG#9559: Functions: Numeric Operations using -ve value gives incorrect
results. Actually a problem when converting decimal to int for user variables. mysql-test/r/sp.result: New test case for BUG#9559. mysql-test/t/sp.test: New test case for BUG#9559. sql/item_func.cc: Don't set the unsigned flag when converting decimal user var to int.
This commit is contained in:
@ -3098,4 +3098,15 @@ call bug5963_2(1)|
|
|||||||
call bug5963_2(1)|
|
call bug5963_2(1)|
|
||||||
drop procedure bug5963_2|
|
drop procedure bug5963_2|
|
||||||
drop table t3|
|
drop table t3|
|
||||||
|
drop function if exists bug9559|
|
||||||
|
create function bug9559()
|
||||||
|
returns int
|
||||||
|
begin
|
||||||
|
set @y = -6/2;
|
||||||
|
return @y;
|
||||||
|
end|
|
||||||
|
select bug9559()|
|
||||||
|
bug9559()
|
||||||
|
-3
|
||||||
|
drop function bug9559|
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
@ -3801,6 +3801,25 @@ call bug5963_2(1)|
|
|||||||
drop procedure bug5963_2|
|
drop procedure bug5963_2|
|
||||||
drop table t3|
|
drop table t3|
|
||||||
|
|
||||||
|
#
|
||||||
|
# BUG#9559: Functions: Numeric Operations using -ve value gives incorrect
|
||||||
|
# results.
|
||||||
|
#
|
||||||
|
--disable_warnings
|
||||||
|
drop function if exists bug9559|
|
||||||
|
--enable_warnings
|
||||||
|
create function bug9559()
|
||||||
|
returns int
|
||||||
|
begin
|
||||||
|
set @y = -6/2;
|
||||||
|
return @y;
|
||||||
|
end|
|
||||||
|
|
||||||
|
select bug9559()|
|
||||||
|
|
||||||
|
drop function bug9559|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# BUG#NNNN: New bug synopsis
|
# BUG#NNNN: New bug synopsis
|
||||||
#
|
#
|
||||||
|
@ -3597,7 +3597,7 @@ longlong user_var_entry::val_int(my_bool *null_value)
|
|||||||
case DECIMAL_RESULT:
|
case DECIMAL_RESULT:
|
||||||
{
|
{
|
||||||
longlong result;
|
longlong result;
|
||||||
my_decimal2int(E_DEC_FATAL_ERROR, (my_decimal *)value, 1, &result);
|
my_decimal2int(E_DEC_FATAL_ERROR, (my_decimal *)value, 0, &result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
case STRING_RESULT:
|
case STRING_RESULT:
|
||||||
|
Reference in New Issue
Block a user