Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Duplicate
-
5.5.35, 10.0.8
-
None
Description
mysql> SELECT CAST(DATE'2001-01-01' AS TIME);
|
+--------------------------------+
|
| CAST(DATE'2001-01-01' AS TIME) |
|
+--------------------------------+
|
| 00:00:00 |
|
+--------------------------------+
|
1 row in set (0.00 sec)
|
|
mysql> DROP PROCEDURE IF EXISTS p1;
|
Query OK, 0 rows affected (0.02 sec)
|
|
mysql> DELIMITER |;
|
mysql> create procedure p1()
|
-> begin
|
-> declare t date;
|
-> set t=date'2001-01-01';
|
-> select cast(t as time);
|
-> end|;
|
Query OK, 0 rows affected (0.04 sec)
|
|
mysql> CALL p1|;
|
+-----------------+
|
| cast(t as time) |
|
+-----------------+
|
| 00:20:01 |
|
+-----------------+
|
1 row in set (0.00 sec)
|
|
Query OK, 0 rows affected, 1 warning (0.00 sec)
|
The two SELECT queries should return the same result.
The problem happens because Item_splocal::get_date() points
to the generic Item::get_date(), so the conversion happens through a
temporary string value: time -> string -> date.
Attachments
Issue Links
- duplicates
-
MDEV-15293 CAST(AS TIME) returns bad results for LAST_VALUE(),NAME_CONST(),SP variable
- Closed