[MDEV-3672] LP:1034131 - select unix_timestamp('0000-00-00') returns NULL instead of 0 Created: 2012-08-07  Updated: 2012-10-04  Resolved: 2012-10-04

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Sergiy Tytarenko (Inactive) Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: Launchpad

Attachments: XML File LPexportBug1034131.xml    

 Description   

MariaDB 5.3.7 returns NULL instead of expected 0 for the the following query:

MariaDB [(none)]> select unix_timestamp('0000-00-00');
------------------------------

unix_timestamp('0000-00-00')

------------------------------

NULL

------------------------------
1 row in set (0.00 sec)

Replacing MariaDB with MySQL 5.1 (Percona SQL server) returns expected 0 as in MySQL 5.0

mysql> select unix_timestamp('0000-00-00');
------------------------------

unix_timestamp('0000-00-00')

------------------------------

0

------------------------------
1 row in set (0.00 sec)



 Comments   
Comment by Elena Stepanova [ 2012-08-07 ]

Re: select unix_timestamp('0000-00-00') returns NULL instead of 0
Hi,

This is intentional and documented behavior: http://kb.askmonty.org/en/unix_timestamp/
(see Error handling at the bottom)

Comment by Rasmus Johansson (Inactive) [ 2012-08-07 ]

Launchpad bug id: 1034131

Generated at Thu Feb 08 06:50:20 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.