[MDEV-3315] LP:738091 - cast(timestamp() AS time returns NULL for 0000-00-00 00:00:00 in 5.1-micro Created: 2011-03-19  Updated: 2015-02-02  Resolved: 2012-10-04

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

Type: Bug Priority: Critical
Reporter: Philip Stoev (Inactive) Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: Launchpad

Attachments: XML File LPexportBug738091.xml    

 Description   

In 5.1-micro, the following expression

cast(timestamp(f1) AS time)

returns NULL if f1 = 0000-00-00 00:00:00 . In mysql-5.1 , it returns 00:00:00, which is the more intuitive result

test case:

drop table t1;
create table t1 (f1 datetime);
insert into t1 values ('0000-00-00 00:00:00');
select cast(timestamp(f1) AS time) from t1;



 Comments   
Comment by Rasmus Johansson (Inactive) [ 2011-10-28 ]

Launchpad bug id: 738091

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