MySQL Forums
Forum List  »  General

Re: Date comparison issue wit mysql 8.0.16
Posted by: Peter Brawley
Date: May 21, 2019 11:08AM

8.0.16 evaluates from_unixtime() correctly ...

select version(), from_unixtime(1360863880706/1000);
+-----------+-----------------------------------+
| version() | from_unixtime(1360863880706/1000) |
+-----------+-----------------------------------+
| 8.0.16    | 2013-02-14 09:44:40.7060          |
+-----------+-----------------------------------+

... but for it to be compared to a string, it needs the value cast to char ...

mysql> select from_unixtime(1360863880706/1000) > '';
ERROR 1525 (HY000): Incorrect DATETIME value: ''

select cast(from_unixtime(1360863880706/1000) as char) > '';
+------------------------------------------------------+
| cast(from_unixtime(1360863880706/1000) as char) > '' |
+------------------------------------------------------+
|                                                    1 |
+------------------------------------------------------+

5.7 doesn't need that, and the 8.0 manual page doesn't mention it, so it looks like a documentation omission you might want to report on the bugs page.



Edited 1 time(s). Last edit at 05/21/2019 11:57AM by Peter Brawley.

Options: ReplyQuote


Subject
Written By
Posted
Re: Date comparison issue wit mysql 8.0.16
May 21, 2019 11:08AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.