[MDEV-5402] Make "constant_string_expr+interval" look inside the constant to detect a correct data type Created: 2013-12-06  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: Data types, Temporal Types
Affects Version/s: 10.0.6
Fix Version/s: 10.11

Type: Bug Priority: Minor
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Unresolved Votes: 0
Labels: datatype

Epic Link: Data type cleanups

 Description   

Notice the difference between the two expressions:

mysql> select '10:10:10'+interval 1 minute, time('10:10:10')+interval 1 minute;
+------------------------------+------------------------------------+
| '10:10:10'+interval 1 minute | time('10:10:10')+interval 1 minute |
+------------------------------+------------------------------------+
| 2010-10-10 00:01:00          | 10:11:10                           |
+------------------------------+------------------------------------+
1 row in set (0.00 sec)

The first expression should return '10:11:10',
similar to the second one.

Let's do it only in 10.x.

Note, another temporal hybrid function ADDTIME() seems to work correctly:

mysql> select addtime('10:10:10',1), addtime('2001-01-01 10:10:10',1);
+-----------------------+----------------------------------+
| addtime('10:10:10',1) | addtime('2001-01-01 10:10:10',1) |
+-----------------------+----------------------------------+
| 10:10:11              | 2001-01-01 10:10:11              |
+-----------------------+----------------------------------+
1 row in set (0.00 sec)


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