[MDEV-16152] Expressions with INTERVAL return bad results in some cases Created: 2018-05-13  Updated: 2018-05-14  Resolved: 2018-05-14

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

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

Issue Links:
Relates
relates to MDEV-16156 PIPES_AS_CONCAT does not work well Open

 Description   

SELECT TIMESTAMP'2001-01-01 10:20:30' - INTERVAL '10' YEAR AS c1,
      -INTERVAL '10' YEAR + TIMESTAMP'2001-01-01 10:20:30' AS c2;

+---------------------+-----------------+
| c1                  | c2              |
+---------------------+-----------------+
| 1991-01-01 10:20:30 | -20110101102030 |
+---------------------+-----------------+

The result for c2 is wrong. It should be the same with c1.

PostgreSQL returns correct results for the same query:

         c1          |         c2          
---------------------+---------------------
 1991-01-01 10:20:30 | 1991-01-01 10:20:30


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