Bug #6976 Wrong OR operator working
Submitted: 3 Dec 2004 5:50 Modified: 14 Dec 2004 5:32
Reporter: [ name withheld ] Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.0 and higher OS:Any (any)
Assigned to: Sergey Petrunya CPU Architecture:Any

[3 Dec 2004 5:50] [ name withheld ]
Description:
Wrong result for A OR NULL operation where A is aggregate function

How to repeat:
mysql> select 1 or null;
+-----------+
| 1 or null |
+-----------+
|         1 | -> OK
+-----------+
1 row in set (0.00 sec)

mysql> create table a ( a int );
Query OK, 0 rows affected (0.00 sec)

mysql> insert into a values( null );
Query OK, 1 row affected (0.00 sec)

mysql> select a is null from a;
+-----------+
| a is null |
+-----------+
|         1 | -> OK
+-----------+
1 row in set (0.00 sec)

mysql> select min( a ) is null from a;
+------------------+
| min( a ) is null |
+------------------+
|                1 | -> OK
+------------------+
1 row in set (0.00 sec)

mysql> select a is null or null from a;
+-------------------+
| a is null or null |
+-------------------+
|                 1 | -> OK
+-------------------+
1 row in set (0.00 sec)

mysql> select min( a ) is null or null from a;
+--------------------------+
| min( a ) is null or null |
+--------------------------+
|                     NULL | -> Not OK !!!
+--------------------------+
1 row in set (0.00 sec)

Suggested fix:
No
[5 Dec 2004 22:19] Sergey Petrunya
ChangeSet@1.2008, 2004-12-06 00:57:41+03:00, sergefp@mysql.com
[14 Dec 2004 5:32] Sergey Petrunya
Pushed into 4.0 earlier and now pushed into 4.1 too