diff options
author | unknown <cmiller@zippy.cornsilk.net> | 2006-11-06 17:13:19 -0500 |
---|---|---|
committer | unknown <cmiller@zippy.cornsilk.net> | 2006-11-06 17:13:19 -0500 |
commit | 2b35fee8ab4bce7c40b95cb6b3b3593bd0960546 (patch) | |
tree | bed54dd373e9401ad43610e0d42dddde20eb40d7 /mysql-test/t/func_test.test | |
parent | e1a722b2d3a428c650bf08527b8c9ed9bdbd3e08 (diff) | |
download | mariadb-git-2b35fee8ab4bce7c40b95cb6b3b3593bd0960546.tar.gz |
Bug#23411: ... MOD-ing zero returns strange result
The Item_func_mod objects never had maybe_null set, so users had no reason
to expect that they can be NULL, and may therefore deduce wrong results.
Now, set maybe_null.
mysql-test/r/func_test.result:
Verify that the predictions are true.
mysql-test/t/func_test.test:
Verify that the predictions are true.
sql/item_func.cc:
MOD functions may be NULL.
Diffstat (limited to 'mysql-test/t/func_test.test')
-rw-r--r-- | mysql-test/t/func_test.test | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test index 2ad64b6c5a6..99519b54ca6 100644 --- a/mysql-test/t/func_test.test +++ b/mysql-test/t/func_test.test @@ -108,4 +108,36 @@ select 5.1 mod 3, 5.1 mod -3, -5.1 mod 3, -5.1 mod -3; select 5 mod 3, 5 mod -3, -5 mod 3, -5 mod -3; +# +# Bug#23411: The "%" (MOD) operator is not documented; MOD-ing zero returns strange result +# Manual: "Division by zero produces a NULL result" +# +select (12%0) <=> null as '1'; +select (12%0) is null as '1'; +select 12%0 as 'NULL'; +select 12%2 as '0'; +select 12%NULL as 'NULL'; +select 12 % null as 'NULL'; +select null % 12 as 'NULL'; +select null % 0 as 'NULL'; +select 0 % null as 'NULL'; +select null % null as 'NULL'; + +select (12 mod 0) <=> null as '1'; +select (12 mod 0) is null as '1'; +select 12 mod 0 as 'NULL'; +select 12 mod 2 as '0'; +select 12 mod null as 'NULL'; +select null mod 12 as 'NULL'; +select null mod 0 as 'NULL'; +select 0 mod null as 'NULL'; +select null mod null as 'NULL'; + +select mod(12.0, 0) as 'NULL'; +select mod(12, 0.0) as 'NULL'; +select mod(12, NULL) as 'NULL'; +select mod(12.0, NULL) as 'NULL'; +select mod(NULL, 2) as 'NULL'; +select mod(NULL, 2.0) as 'NULL'; + # End of 4.1 tests |