Details
-
Type:
Bug
-
Status: Closed (View Workflow)
-
Priority:
Minor
-
Resolution: Duplicate
-
Affects Version/s: 5.5.35, 10.0.8
-
Fix Version/s: 10.3.5
-
Component/s: Data Definition - Temporary
-
Labels: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
-