mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug23411/my41-bug23411
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-4.1-maint
This commit is contained in:
commit
02e764bd10
4 changed files with 111 additions and 1 deletions
|
@ -1 +1,3 @@
|
|||
452a92d0-31-8wSzSfZi165fcGcXPA
|
||||
454a7ef8gdvE_ddMlJyghvOAkKPNOQ
|
||||
454f8960jsVT_kMKJtZ9OCgXoba0xQ
|
||||
|
|
|
@ -183,3 +183,78 @@ 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;
|
||||
5 mod 3 5 mod -3 -5 mod 3 -5 mod -3
|
||||
2 2 -2 -2
|
||||
select (12%0) <=> null as '1';
|
||||
1
|
||||
1
|
||||
select (12%0) is null as '1';
|
||||
1
|
||||
1
|
||||
select 12%0 as 'NULL';
|
||||
NULL
|
||||
NULL
|
||||
select 12%2 as '0';
|
||||
0
|
||||
0
|
||||
select 12%NULL as 'NULL';
|
||||
NULL
|
||||
NULL
|
||||
select 12 % null as 'NULL';
|
||||
NULL
|
||||
NULL
|
||||
select null % 12 as 'NULL';
|
||||
NULL
|
||||
NULL
|
||||
select null % 0 as 'NULL';
|
||||
NULL
|
||||
NULL
|
||||
select 0 % null as 'NULL';
|
||||
NULL
|
||||
NULL
|
||||
select null % null as 'NULL';
|
||||
NULL
|
||||
NULL
|
||||
select (12 mod 0) <=> null as '1';
|
||||
1
|
||||
1
|
||||
select (12 mod 0) is null as '1';
|
||||
1
|
||||
1
|
||||
select 12 mod 0 as 'NULL';
|
||||
NULL
|
||||
NULL
|
||||
select 12 mod 2 as '0';
|
||||
0
|
||||
0
|
||||
select 12 mod null as 'NULL';
|
||||
NULL
|
||||
NULL
|
||||
select null mod 12 as 'NULL';
|
||||
NULL
|
||||
NULL
|
||||
select null mod 0 as 'NULL';
|
||||
NULL
|
||||
NULL
|
||||
select 0 mod null as 'NULL';
|
||||
NULL
|
||||
NULL
|
||||
select null mod null as 'NULL';
|
||||
NULL
|
||||
NULL
|
||||
select mod(12.0, 0) as 'NULL';
|
||||
NULL
|
||||
NULL
|
||||
select mod(12, 0.0) as 'NULL';
|
||||
NULL
|
||||
NULL
|
||||
select mod(12, NULL) as 'NULL';
|
||||
NULL
|
||||
NULL
|
||||
select mod(12.0, NULL) as 'NULL';
|
||||
NULL
|
||||
NULL
|
||||
select mod(NULL, 2) as 'NULL';
|
||||
NULL
|
||||
NULL
|
||||
select mod(NULL, 2.0) as 'NULL';
|
||||
NULL
|
||||
NULL
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -96,7 +96,7 @@ Item_func::Item_func(THD *thd, Item_func *item)
|
|||
|
||||
|
||||
/*
|
||||
Resolve references to table column for a function and it's argument
|
||||
Resolve references to table column for a function and its argument
|
||||
|
||||
SYNOPSIS:
|
||||
fix_fields()
|
||||
|
@ -707,6 +707,7 @@ longlong Item_func_mod::val_int()
|
|||
void Item_func_mod::fix_length_and_dec()
|
||||
{
|
||||
Item_num_op::fix_length_and_dec();
|
||||
maybe_null= 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue