[MDEV-19642] Adding and Removing Time Periods section syntax error with SQLs Created: 2019-05-30  Updated: 2019-06-06  Resolved: 2019-06-06

Status: Closed
Project: MariaDB Server
Component/s: Documentation
Fix Version/s: N/A

Type: Task Priority: Major
Reporter: Shahriyar Rzayev (Inactive) Assignee: Ian Gilfillan
Resolution: Fixed Votes: 0
Labels: Documentation, docs


 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



 Comments   
Comment by Sergei Golubchik [ 2019-06-05 ]

FYI, in case it wasn't clear, the correct standard syntax is DROP PERIOD FOR xxx

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