diff options
author | Alexey Kopytov <Alexey.Kopytov@Sun.com> | 2009-10-13 12:31:42 +0400 |
---|---|---|
committer | Alexey Kopytov <Alexey.Kopytov@Sun.com> | 2009-10-13 12:31:42 +0400 |
commit | 7e3b4d21c0010bf6bc4fd8cdb8eee3caf8207f29 (patch) | |
tree | fea2364401dec8d958b129af9bc211c8ad3c9f96 /mysql-test/t/alias.test | |
parent | 4337c3808f32c0851b7b9e6efb2516302d691bf8 (diff) | |
download | mariadb-git-7e3b4d21c0010bf6bc4fd8cdb8eee3caf8207f29.tar.gz |
Backport of the patch for bug #8457 "Precision math: DIV
returns incorrect result with large decimal value"
For the DIV operator, neither operands nor result were checked
for integer overflows.
This patch changes the DIV behavior for non-integer operands as
follows: if either of the operands has a non-integer type,
convert both operands to the DECIMAL type, then calculate the
division using DECIMAL arithmetics. Convert the resulting
DECIMAL value into BIGINT [UNSIGNED] if it fits into the
corresponding range, or throw an 'out of range' error
otherwise.
mysql-test/r/func_math.result:
Added a test case for bug #8457.
Fixed results for a test case depending on the wrong behavior.
mysql-test/r/type_varchar.result:
Fixed results for a test case depending on the wrong behavior.
mysql-test/t/func_math.test:
Added a test case for bug #8457.
sql/item_func.cc:
If either of the operands has a non-integer type, convert both
operands to the DECIMAL type, then calculate the division using
DECIMAL arithmetics. Convert the resulting DECIMAL value into
BIGINT [UNSIGNED] if it fits into the corresponding range, or
throw an 'out of range' error otherwise.
Diffstat (limited to 'mysql-test/t/alias.test')
0 files changed, 0 insertions, 0 deletions