XMB Forum Software

Oracle's MySQL actually handles UNIX_TIMESTAMP better than MariaDB!

flushedpancake - 4-22-2024 at 11:13 AM

MySQL
Code:
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8 Server version: 8.0.36 MySQL Community Server - GPL Copyright (c) 2000, 2024, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> select unix_timestamp("2038-01-20"); +------------------------------+ | unix_timestamp("2038-01-20") | +------------------------------+ | 2147558400 | +------------------------------+ 1 row in set (0.00 sec) mysql>


MariaDB
Code:
Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 11.2.3-MariaDB MariaDB package Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> select unix_timestamp("2038-01-20"); +------------------------------+ | unix_timestamp("2038-01-20") | +------------------------------+ | NULL | +------------------------------+ 1 row in set (0.000 sec) MariaDB [(none)]>


This wasn't on the same system or even the same OS (I'm running Debian on the VPS, which uses MySQL 8, and openSUSE Tumbleweed on my desktop), though both were running on 64-bit.

Pretty cool though, kinda interesting that Oracle decided to actually take into account if the user is running the database on 64-bit hardware and let you use unix_timestamp() with a 64-bit date, while the MariaDB guys decided to arbitrarily enforce the 32-bit signed integer limit.

(Usually MariaDB seems to be the one people go for but in terms of future-proofing it looks like MySQL seems to be taking the lead here.)

Xian - 5-1-2024 at 10:12 PM

Interesting... Thanks for the share!

lottos - 5-6-2024 at 01:23 AM

Have they fixed this or is there a workaround?

flushedpancake - 6-18-2024 at 08:53 AM

Quote: Originally posted by lottos  
Have they fixed this or is there a workaround?

If I remember right MariaDB basically pulled a 'won't fix' on it.