Bug #83385 Manual is wrong about '=' comparison with NULL
Submitted: 14 Oct 2016 11:31 Modified: 24 Oct 2016 13:25
Reporter: Jörg Brühe (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.5 and up OS:Any
Assigned to: CPU Architecture:Any

[14 Oct 2016 11:31] Jörg Brühe
Description:
The manual makes a wrong statement about the '=' (equality) comparison operator:

In page 'comparison-operators.html' when describing the 'ISNULL()' predicate, it states

>  ISNULL() can be used instead of = to test whether a value is NULL.
>  (Comparing a value to NULL using = always yields false.) 

The bracketed sentence is terribly wrong, such comparisons always (correctly) return NULL (the "unknown" result):

mysql> select 0 = NULL,  1 = NULL,  NULL = NULL ;
+----------+----------+-------------+
| 0 = NULL | 1 = NULL | NULL = NULL |
+----------+----------+-------------+
|     NULL |     NULL |        NULL |
+----------+----------+-------------+
1 row in set (0,00 sec)

The description of the 'isnull()' function itself is correct:

mysql> select isnull(0), isnull(1), isnull(NULL) ;
+-----------+-----------+--------------+
| isnull(0) | isnull(1) | isnull(NULL) |
+-----------+-----------+--------------+
|         0 |         0 |            1 |
+-----------+-----------+--------------+
1 row in set (0,00 sec)

How to repeat:
Check the manual for 5.5, 5.6 or 5.7.

To verify MySQL works correct, run the first "select" command above.

Suggested fix:
The bracketed sentence must read:

Comparing a value to NULL using = always yields NULL, representing the "unknown" truth value.
[14 Oct 2016 12:03] MySQL Verification Team
Hello Jörg,

Thank you for the report and feedback.

Thanks,
Umesh
[24 Oct 2016 13:25] Paul DuBois
Posted by developer:
 
Updated the IS_NULL() description.