> Your patch looks ok, but I have now split the date add/sub code
> to make it faster and shorter; This will be in 3.23.22 (I don't
> submit a patch now as I want to test this throughly before releasing it!)
I'm not shure if this is allready a source of this problems, but currently
such thing is happening:
mysql> select date_add(0, interval 7 day)<20000101;
+--------------------------------------+
| date_add(0, interval 7 day)<20000101 |
+--------------------------------------+
| NULL |
+--------------------------------------+
1 row in set (0.01 sec)
mysql> select 0<date_sub(20000101,interval 7 day);
+-------------------------------------+
| 0<date_sub(20000101,interval 7 day) |
+-------------------------------------+
| 1 |
+-------------------------------------+
1 row in set (0.00 sec)
Therefore this selects are mathematically equal. Even the first result may
be right, but if so the second one should be exactly the same :)