MDEV-35651 NO_UNSIGNED_SUBTRACTION does not work for multiple unsigned integers
restore correct unsigned-unsigned logic followup for 031f11717d9
This commit is contained in:
parent
680d461b5d
commit
828b928fce
@ -1,4 +1,3 @@
|
||||
drop table if exists t1;
|
||||
select floor(5.5),floor(-5.5);
|
||||
floor(5.5) floor(-5.5)
|
||||
5 -6
|
||||
@ -3632,5 +3631,17 @@ SELECT(ASIN(-1)+ LN(-1)) % (ATAN(-1) MOD FLOOR(1)) * (TRUNCATE(EXP(-1.e-2),-1.e+
|
||||
c1
|
||||
NULL
|
||||
#
|
||||
# End of 10.5 tests
|
||||
# MDEV-35651 NO_UNSIGNED_SUBTRACTION does not work for multiple unsigned integers
|
||||
#
|
||||
set sql_mode=no_unsigned_subtraction;
|
||||
select cast(0 as unsigned) - 1;
|
||||
cast(0 as unsigned) - 1
|
||||
-1
|
||||
select 2-cast(3 as unsigned);
|
||||
2-cast(3 as unsigned)
|
||||
-1
|
||||
select cast(1 as unsigned) - cast(2 as unsigned);
|
||||
cast(1 as unsigned) - cast(2 as unsigned)
|
||||
-1
|
||||
set sql_mode=default;
|
||||
# End of 10.5 tests
|
||||
|
@ -4,10 +4,6 @@
|
||||
|
||||
--source include/default_charset.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
select floor(5.5),floor(-5.5);
|
||||
explain extended select floor(5.5),floor(-5.5);
|
||||
select ceiling(5.5),ceiling(-5.5);
|
||||
@ -1941,7 +1937,13 @@ SELECT (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) AS c1;
|
||||
SELECT (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) * (LAST_DAY('1-03-30 1:29:12') MOD 1 + COS(-1)) AS c1;
|
||||
SELECT(ASIN(-1)+ LN(-1)) % (ATAN(-1) MOD FLOOR(1)) * (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) * (LAST_DAY('1-03-30 1:29:12') MOD 1 + COS(-1)) AS c1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-35651 NO_UNSIGNED_SUBTRACTION does not work for multiple unsigned integers
|
||||
--echo #
|
||||
set sql_mode=no_unsigned_subtraction;
|
||||
select cast(0 as unsigned) - 1;
|
||||
select 2-cast(3 as unsigned);
|
||||
select cast(1 as unsigned) - cast(2 as unsigned);
|
||||
set sql_mode=default;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.5 tests
|
||||
--echo #
|
||||
|
@ -1316,9 +1316,10 @@ longlong Item_func_minus::int_op()
|
||||
{
|
||||
if (args[1]->unsigned_flag)
|
||||
{
|
||||
if ((ulonglong) val0 < (ulonglong) val1)
|
||||
if ((ulonglong) val0 >= (ulonglong) val1)
|
||||
res_unsigned= TRUE;
|
||||
else if ((ulonglong)val1 - (ulonglong)val0 > (ulonglong)LONGLONG_MAX)
|
||||
goto err;
|
||||
res_unsigned= TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user