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

parser greedily parses AS OF TIMESTAMP

Details

    Description

      In AS OF TIMESTAMP xxx, the TIMESTAMP is always parsed as a part of AS OF, even if it's actually a part of the expression (the complete expression being TIMESTAMP xxx).

      Examples:

      DATETIME literal

      SELECT TIMESTAMP'2016-02-30 08:07:06';
      → ERROR 1525 (HY000): Incorrect DATETIME value: '2016-02-30 08:07:06'
      SELECT * FROM t1 FOR SYSTEM_TIME AS OF TIMESTAMP'2016-02-30 08:07:06';
      → ok
      SELECT * FROM t1 FOR SYSTEM_TIME AS OF (TIMESTAMP'2016-02-30 08:07:06');
      → ERROR 1525 (HY000): Incorrect DATETIME value: '2016-02-30 08:07:06'
      

      two-argument TIMESTAMP() function

      SELECT TIMESTAMP('2003-12-31 12:00:00','12:00:00');
      → ok
      SELECT * FROM t1 FOR SYSTEM_TIME AS OF TIMESTAMP('2003-12-31 12:00:00','12:00:00')
      → ERROR 1241 (21000): Operand should contain 1 column(s)
      SELECT * FROM t1 FOR SYSTEM_TIME AS OF (TIMESTAMP('2003-12-31 12:00:00','12:00:00'));
      → ok
      

      Attachments

        Issue Links

          Activity

            serg Sergei Golubchik created issue -
            serg Sergei Golubchik made changes -
            Field Original Value New Value
            Description In {{AS OF TIMESTAMP xxx}}, the {{TIMESTAMP}} is always parsed as a part of {{AS OF}}, even if it's actually, a part of the expression (the complete expression being {{TIMESTAMP xxx}}).

            Examples:
            {code:sql|title=DATETIME literal}
            SELECT TIMESTAMP'2016-02-30 08:07:06';
            → ERROR 1525 (HY000): Incorrect DATETIME value: '2016-02-30 08:07:06'
            SELECT * FROM t1 FOR SYSTEM_TIME AS OF TIMESTAMP'2016-02-30 08:07:06';
            → ok
            SELECT * FROM t1 FOR SYSTEM_TIME AS OF (TIMESTAMP'2016-02-30 08:07:06');
            → ERROR 1525 (HY000): Incorrect DATETIME value: '2016-02-30 08:07:06'
            {code}
            {code:sql|title=two-argument TIMESTAMP() function}
            SELECT TIMESTAMP('2003-12-31 12:00:00','12:00:00');
            → ok
            SELECT * FROM t1 FOR SYSTEM_TIME AS OF TIMESTAMP('2003-12-31 12:00:00','12:00:00')
            → ERROR 1241 (21000): Operand should contain 1 column(s)
            SELECT * FROM t1 FOR SYSTEM_TIME AS OF (TIMESTAMP('2003-12-31 12:00:00','12:00:00'));
            → ok
            {code}
            In {{AS OF TIMESTAMP xxx}}, the {{TIMESTAMP}} is always parsed as a part of {{AS OF}}, even if it's actually a part of the expression (the complete expression being {{TIMESTAMP xxx}}).

            Examples:
            {code:sql|title=DATETIME literal}
            SELECT TIMESTAMP'2016-02-30 08:07:06';
            → ERROR 1525 (HY000): Incorrect DATETIME value: '2016-02-30 08:07:06'
            SELECT * FROM t1 FOR SYSTEM_TIME AS OF TIMESTAMP'2016-02-30 08:07:06';
            → ok
            SELECT * FROM t1 FOR SYSTEM_TIME AS OF (TIMESTAMP'2016-02-30 08:07:06');
            → ERROR 1525 (HY000): Incorrect DATETIME value: '2016-02-30 08:07:06'
            {code}
            {code:sql|title=two-argument TIMESTAMP() function}
            SELECT TIMESTAMP('2003-12-31 12:00:00','12:00:00');
            → ok
            SELECT * FROM t1 FOR SYSTEM_TIME AS OF TIMESTAMP('2003-12-31 12:00:00','12:00:00')
            → ERROR 1241 (21000): Operand should contain 1 column(s)
            SELECT * FROM t1 FOR SYSTEM_TIME AS OF (TIMESTAMP('2003-12-31 12:00:00','12:00:00'));
            → ok
            {code}
            midenok Aleksey Midenkov made changes -
            Assignee Alexander Krizhanovsky [ krizhanovsky ] Aleksey Midenkov [ midenok ]
            midenok Aleksey Midenkov made changes -
            Fix Version/s 10.3.5 [ 22905 ]
            Fix Version/s 10.3 [ 22126 ]
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Closed [ 6 ]
            serg Sergei Golubchik made changes -
            Resolution Fixed [ 1 ]
            Status Closed [ 6 ] Stalled [ 10000 ]
            serg Sergei Golubchik made changes -
            Assignee Aleksey Midenkov [ midenok ] Sergei Golubchik [ serg ]
            serg Sergei Golubchik made changes -
            Status Stalled [ 10000 ] In Review [ 10002 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.3 [ 22126 ]
            Fix Version/s 10.3.5 [ 22905 ]
            serg Sergei Golubchik made changes -
            Sprint 10.3.5-1 [ 229 ]
            serg Sergei Golubchik made changes -
            Priority Major [ 3 ] Critical [ 2 ]
            serg Sergei Golubchik made changes -
            Assignee Sergei Golubchik [ serg ] Aleksey Midenkov [ midenok ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.3.5 [ 22905 ]
            Fix Version/s 10.3 [ 22126 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            serg Sergei Golubchik made changes -
            Sprint 10.3.5-1 [ 229 ]
            bar Alexander Barkov made changes -
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 84964 ] MariaDB v4 [ 153604 ]

            People

              midenok Aleksey Midenkov
              serg Sergei Golubchik
              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.