Bug #90649 `select null or true` not consistent with `select null or false`
Submitted: 26 Apr 2018 14:55 Modified: 8 May 2018 5:47
Reporter: David Portabella Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.5.54 OS:Any
Assigned to: MySQL Verification Team CPU Architecture:Any

[26 Apr 2018 14:55] David Portabella
Description:
mysql> select null or true;
+--------------+
| null or true |
+--------------+
|            1 |
+--------------+
1 row in set (0.04 sec)

mysql> select null or false;
+---------------+
| null or false |
+---------------+
|          NULL |
+---------------+
1 row in set (0.05 sec)

this is not consistent. Either both should return NULL, or both should return 1 or 0.

How to repeat:
select null or true;
select null or false;

Suggested fix:
either both queries should return NULL, or both should return 1 or 0 (not NULL).
[27 Apr 2018 14:57] MySQL Verification Team
Hi,

It's expected optimization, the "or false" returns the rest of expression and "or true" returns true not looking at the rest of expression so data type of result will differ. I doubt this is a bug but have to check SQL specification first

kind regards
Bogdan
[8 May 2018 5:47] MySQL Verification Team
Hi,

This def. is not a bug. I tested other SQL servers and they behave identically (postgresql too for example), and the SQL standard is not defining this as far as I can see so no changes going to happen here.

all best
Bogdan