Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-16152

Expressions with INTERVAL return bad results in some cases

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 5.5, 10.0, 10.1, 10.2, 10.3, 10.4
    • 10.3.7
    • Temporal Types
    • None

    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
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.