BETWEEN with datetime + NULL does not return NULL in 5.1-micro

Bug #736780 reported by Philip Stoev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MariaDB
Won't Fix
Undecided
Sergei Golubchik

Bug Description

Not repeatable in mysql-5.1. In 5.1-micro, BETWEEN expressions that contain a datetime and NULL do not return NULL. Instead, they return FALSE, which is incorrect.

To repeat:

MySQL [test]> SELECT NOW() BETWEEN NULL AND '2011-01-01' ;
+-------------------------------------+
| NOW() BETWEEN NULL AND '2011-01-01' |
+-------------------------------------+
| 0 |
+-------------------------------------+
1 row in set (0.01 sec)

should have returned NULL

Related branches

Changed in maria:
milestone: none → 5.3
assignee: nobody → Sergei (sergii)
Revision history for this message
Sergei Golubchik (sergii) wrote :

This is intentional and correct.

Compare with SELECT 10 BETWEEN NULL AND 5;
Or with SELECT "Z" BETWEEN NULL AND "A";

Because the compared value is larger than the upper bound, the value of BETWEEN is false, even if the lower bound is unknown.

Changed in maria:
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.