Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.5.9, 10.3(EOL), 10.4(EOL), 10.5(EOL)
-
None
-
Linux
-
Unexpected results
Description
A literal NULL behaves differently from a computed NULL:
MariaDB [anr]> select case 'X' when null then 1 when 'X' then 2 else 3 end;
|
+------------------------------------------------------+
|
| case 'X' when null then 1 when 'X' then 2 else 3 end |
|
+------------------------------------------------------+
|
| 2 |
|
+------------------------------------------------------+
|
1 row in set (0.000 sec)
|
 |
MariaDB [anr]> select case 'X' when 1/0 then 1 when 'X' then 2 else 3 end;
|
+-----------------------------------------------------+
|
| case 'X' when 1/0 then 1 when 'X' then 2 else 3 end |
|
+-----------------------------------------------------+
|
| 3 |
|
+-----------------------------------------------------+
|
1 row in set, 1 warning (0.000 sec)
|
The second select should (imho) also evaluate to 2. Versions of MySQL I've check (5.6/5.7) give consistent results (return the value 2 in all cases).