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

Syntax error upon "FOR system_time" query from derived table

    XMLWordPrintable

Details

    Description

      MariaDB [test]> create or replace table t1 (i int) with system versioning;
      Query OK, 0 rows affected (0.18 sec)
      

      This does not work:

      MariaDB [test]> select * from (select * from t1) drv for system_time as of now();
      ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'system_time as of now()' at line 1
      

      The right syntax apparently is

      MariaDB [test]> select * from (select * from t1) for system_time as of now() drv;
      Empty set (0.00 sec)
      

      I want to ensure it's intentional, since the working syntax looks confusing.


      Test case for copy-pasting

      CREATE TABLE t1 (i INT) WITH SYSTEM VERSIONING;
      SELECT * FROM t1 FOR system_time ALL;
      SELECT * FROM ( SELECT * FROM t1 ) t FOR system_time ALL;
       
      # Cleanup
      DROP TABLE t1;
      

      Attachments

        Activity

          People

            serg Sergei Golubchik
            elenst Elena Stepanova
            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.