[MDEV-4804] Date comparing false result Created: 2013-07-22 Updated: 2013-08-22 Resolved: 2013-08-22 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 5.5.32, 5.3.12 |
| Fix Version/s: | 5.5.33, 5.3.13 |
| Type: | Bug | Priority: | Critical |
| Reporter: | bulepage | Assignee: | Alexander Barkov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Linux |
||
| Description |
|
Date comparing is true in 5.5.32 but in 5.5.30 is false. False is the good result. |
| Comments |
| Comment by Elena Stepanova [ 2013-07-23 ] | ||||||||
|
The problem came in two steps. revno: 3636 revno: 3665 Until the revision 3636, it worked all right – date("0") returned NULL, h1d was set to date(now()), and comparison returned false: h0d h1d compare_h0_gt_h1 Since revno 3636 and until revision 3635, date("0") returned "0000-00-00", and consequently the comparison returned true: h0d h1d compare_h0_gt_h1 Starting with revno 3665, date("0") returns NULL again, and h1d is date(now()) again, but comparison result remains true: h0d h1d compare_h0_gt_h1 | ||||||||
| Comment by Alexander Barkov [ 2013-08-20 ] | ||||||||
|
A smaller test case demonstrating the problem: MariaDB [test]> SELECT DATE('20011107'),DATE('0'),COALESCE(DATE('0'),CURRENT_DATE) AS d1, DATE('20011107')>COALESCE(DATE('0'),CURRENT_DATE) AS cmp;
-----------------
----------------- | ||||||||
| Comment by Alexander Barkov [ 2013-08-20 ] | ||||||||
|
IFNULL has the same problem: MariaDB [test]> SELECT DATE('20011107'),DATE('0'),IFNULL(DATE('0'),CURRENT_DATE) AS d1, DATE('20011107')>IFNULL(DATE('0'),CURRENT_DATE) AS cmp;
-----------------
----------------- | ||||||||
| Comment by Alexander Barkov [ 2013-08-22 ] | ||||||||
|
Pushed to 5.3.13 and 5.5.33 |