From 1646d4a6d1ff68161ebe62819719ef7cc028cf27 Mon Sep 17 00:00:00 2001 From: Nicolas Spiegelberg <53198280+nspiegelberg@users.noreply.github.com> Date: Thu, 19 Sep 2019 15:36:12 -0700 Subject: [PATCH] [docs][YSQL][#2355] DROP TABLE multiple tables (#2355) (#2382) --- docs/content/latest/api/ysql/commands/ddl_drop_table.md | 8 ++++++-- .../ysql/syntax_resources/commands/drop_table.diagram.md | 2 +- .../ysql/syntax_resources/commands/drop_table.grammar.md | 2 +- .../latest/api/ysql/syntax_resources/grammar_diagrams.md | 4 ++-- .../latest/api/ysql/syntax_resources/ysql_grammar.ebnf | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/docs/content/latest/api/ysql/commands/ddl_drop_table.md b/docs/content/latest/api/ysql/commands/ddl_drop_table.md index 7c41bd4c2a11..2af4d0a29c30 100644 --- a/docs/content/latest/api/ysql/commands/ddl_drop_table.md +++ b/docs/content/latest/api/ysql/commands/ddl_drop_table.md @@ -15,7 +15,7 @@ showAsideToc: true ## Synopsis -Use the `DROP TABLE` statement to remove a table and all of its data from the database. +Use the `DROP TABLE` statement to remove one or more tables (with all of their data) from the database. ## Syntax @@ -47,9 +47,13 @@ Use the `DROP TABLE` statement to remove a table and all of its data from the da ### *drop_table* +#### *if_exists* + +Under normal operation, an error is raised if the table does not exist. Adding `IF EXISTS` will quietly ignore any non-existent tables specified. + #### *table_name* -Specify the name of the table to be dropped. If the table does not exist, an error is raised. Objects associated with the table, such as prepared statements, will be eventually invalidated after the `DROP TABLE` statement is completed. +Specify the name of the table to be dropped. Objects associated with the table, such as prepared statements, will be eventually invalidated after the `DROP TABLE` statement is completed. ## See also diff --git a/docs/content/latest/api/ysql/syntax_resources/commands/drop_table.diagram.md b/docs/content/latest/api/ysql/syntax_resources/commands/drop_table.diagram.md index 7da7d32f11a3..5d076688ea1d 100644 --- a/docs/content/latest/api/ysql/syntax_resources/commands/drop_table.diagram.md +++ b/docs/content/latest/api/ysql/syntax_resources/commands/drop_table.diagram.md @@ -1,4 +1,4 @@ #### drop_table -DROPTABLEIFEXISTStable_name +DROPTABLEIFEXISTS,table_name diff --git a/docs/content/latest/api/ysql/syntax_resources/commands/drop_table.grammar.md b/docs/content/latest/api/ysql/syntax_resources/commands/drop_table.grammar.md index 35498e1a8815..06855f49f281 100644 --- a/docs/content/latest/api/ysql/syntax_resources/commands/drop_table.grammar.md +++ b/docs/content/latest/api/ysql/syntax_resources/commands/drop_table.grammar.md @@ -1,3 +1,3 @@ ``` -drop_table ::= DROP TABLE [ IF EXISTS ] table_name +drop_table ::= DROP TABLE [ IF EXISTS ] table_name [ , ... ] ``` diff --git a/docs/content/latest/api/ysql/syntax_resources/grammar_diagrams.md b/docs/content/latest/api/ysql/syntax_resources/grammar_diagrams.md index 070fb9616acf..989776155e2b 100644 --- a/docs/content/latest/api/ysql/syntax_resources/grammar_diagrams.md +++ b/docs/content/latest/api/ysql/syntax_resources/grammar_diagrams.md @@ -1113,9 +1113,9 @@ drop_sequence ::= DROP SEQUENCE [ IF EXISTS ] sequence_name ### drop_table ``` -drop_table ::= DROP TABLE [ IF EXISTS ] table_name +drop_table ::= DROP TABLE [ IF EXISTS ] table_name [ , ... ] ``` -DROPTABLEIFEXISTStable_name +DROPTABLEIFEXISTS,table_name ### drop_type ``` diff --git a/docs/content/latest/api/ysql/syntax_resources/ysql_grammar.ebnf b/docs/content/latest/api/ysql/syntax_resources/ysql_grammar.ebnf index ddfc0e765e31..f85b8a41cd6a 100644 --- a/docs/content/latest/api/ysql/syntax_resources/ysql_grammar.ebnf +++ b/docs/content/latest/api/ysql/syntax_resources/ysql_grammar.ebnf @@ -634,7 +634,7 @@ drop_rule = 'DROP' 'RULE' [ 'IF' 'EXISTS' ] rule_name 'ON' table_name [ 'CASCADE drop_sequence ::= 'DROP' 'SEQUENCE' [ 'IF' 'EXISTS' ] sequence_name [ 'CASCADE' | 'RESTRICT' ] ; (* 'DROP' 'TABLE' *) -drop_table ::= 'DROP' 'TABLE' [ 'IF' 'EXISTS' ] table_name ; +drop_table ::= 'DROP' 'TABLE' [ 'IF' 'EXISTS' ] table_name { ',' table_name} ; (* 'DROP' 'TYPE' *) drop_type ::= 'DROP' 'TYPE' [ 'IF' 'EXISTS' ] type_name { ',' type_name }