[MDEV-2970] LP:737458 - Casting dates and times into integers works differently in 5.1-micro Created: 2011-03-18  Updated: 2020-09-08  Resolved: 2012-10-04

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

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

Attachments: XML File LPexportBug737458.xml    

 Description   

Casting and comparing dates and times into or to integers does not work in 5.1-micro as it works in mysql-5.1. For a timestamp "YYYY-MM-DD HH:MM:SS" , mysql-5.1 produces an integer YYYYMMDDHHMMSS whereas 5.1-micro produces just YYYY

test case

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (f1 TIME, f2 DATE, f3 DATETIME);
INSERT INTO t1 VALUES ('11:22:33','2011-12-13','2011-12-13 11:22:33');
SELECT CAST(f1 AS UNSIGNED), CAST(f2 AS UNSIGNED), CAST(f3 AS UNSIGNED) FROM t1;

5.1-micro returns:

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

CAST(f1 AS UNSIGNED) CAST(f2 AS UNSIGNED) CAST(f3 AS UNSIGNED)

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

11 2011 2011

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

mysql-5.1 returns:

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

CAST(f1 AS UNSIGNED) CAST(f2 AS UNSIGNED) CAST(f3 AS UNSIGNED)

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

112233 20111213 20111213112233

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



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

Launchpad bug id: 737458

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