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

Adding and Removing Time Periods section syntax error with SQLs

    XMLWordPrintable

Details

    Description

      Doc link:
      https://mariadb.com/kb/en/library/temporal-data-tables/#adding-and-removing-time-periods

      "To remove a period, use the DROP PERIOD clause:

      ALTER TBALE test.t2 DROP PERIOD time_period;"

      It is clear that it should be TABLE, but:

      ALTER TABLE test.t2 DROP PERIOD time_period;
      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 'time_period' at line 1
      

      It seems to be:

      MariaDB [test]> ALTER TABLE test.t2 DROP PERIOD for time_period;
      Query OK, 0 rows affected (0.065 sec)
      Records: 0  Duplicates: 0  Warnings: 0
      

      Same applies below:

      "Both ADD PERIOD and DROP PERIOD clauses include an option to handle whether the period already exists:

      ALTER TABLE test.t2 ADD PERIOD IF NOT EXISTS time_period(date_1, date_2);

      ALTER TABLE test.t2 DROP PERIOD IF EXISTS time_period;
      "

      Syntax error for given SQLs:

      ALTER TABLE test.t2 ADD PERIOD IF NOT EXISTS time_period(date_1, date_2);
      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 'time_period(date_1, date_2)' at line 1
      

      Testing:

      ALTER TABLE test.t2 ADD PERIOD IF NOT EXISTS for time_period(date_1, date_2);
      ERROR 1054 (42S22): Unknown column 'date_1' in 'time_period'
      

      Now it is clear that the command should be:

      ALTER TABLE test.t2 ADD PERIOD IF NOT EXISTS for time_period(time_1, time_2);
      Query OK, 0 rows affected (0.341 sec)              
      Records: 0  Duplicates: 0  Warnings: 0
      

      The last one:

      MariaDB [test]> ALTER TABLE test.t2 DROP PERIOD IF EXISTS time_period;
      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 'time_period' at line 1
       
      MariaDB [test]> ALTER TABLE test.t2 DROP PERIOD IF EXISTS for time_period;
      Query OK, 0 rows affected (0.072 sec)
      Records: 0  Duplicates: 0  Warnings: 0
      

      Attachments

        Activity

          People

            greenman Ian Gilfillan
            shako Shahriyar Rzayev (Inactive)
            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.