[MDEV-15363] Wrong result for CAST(LAST_DAY(TIME'00:00:00') AS TIME) Created: 2018-02-20  Updated: 2018-08-03  Resolved: 2018-08-03

Status: Closed
Project: MariaDB Server
Component/s: Temporal Types
Affects Version/s: 10.0, 10.1, 10.2, 10.3
Fix Version/s: 10.3.5

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-4912 Data type plugin API version 1 Closed
blocks MDEV-8894 Inserting fractional seconds into My... Closed
Duplicate
duplicates MDEV-15340 Wrong result HOUR(case_expression_wit... Closed

 Description   

SELECT
  LAST_DAY(TIME'00:00:00') AS c1,
  CAST(CAST(LAST_DAY(TIME'00:00:00') AS DATE) AS TIME) AS c2,
  CAST(LAST_DAY(TIME'00:00:00') AS TIME) AS c3;

+------------+----------+------+
| c1         | c2       | c3   |
+------------+----------+------+
| 2018-02-28 | 00:00:00 | NULL |
+------------+----------+------+

Notice, LAST_DAY(TIME'00:00:00') correctly returns the last day of the current month.
If I now cast this expression as DATE, and then cast as TIME again (like in c2), it correctly returns 00:00:00.
But if I cast this expression directly to TIME (like in c3), it erroneously returns NULL.

It should return 00:00:00 in the column c3.



 Comments   
Comment by Alexander Barkov [ 2018-08-03 ]

This problem was earlier fixed by the patch for MDEV-15340.

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