diff --git a/docs/generated/sql/bnf/stmt_block.bnf b/docs/generated/sql/bnf/stmt_block.bnf index 2b778f2d454d..4b14c2b23cfd 100644 --- a/docs/generated/sql/bnf/stmt_block.bnf +++ b/docs/generated/sql/bnf/stmt_block.bnf @@ -16,6 +16,7 @@ stmt ::= | release_stmt | nonpreparable_set_stmt | transaction_stmt + | close_cursor_stmt | preparable_stmt ::= @@ -90,6 +91,9 @@ transaction_stmt ::= | rollback_stmt | abort_stmt +close_cursor_stmt ::= + 'CLOSE' 'ALL' + alter_stmt ::= alter_ddl_stmt | alter_user_stmt @@ -642,6 +646,7 @@ unreserved_keyword ::= | 'CANCEL' | 'CASCADE' | 'CHANGEFEED' + | 'CLOSE' | 'CLUSTER' | 'COLUMNS' | 'COMMENT' @@ -667,6 +672,7 @@ unreserved_keyword ::= | 'DATE' | 'DAY' | 'DEALLOCATE' + | 'DECLARE' | 'DELETE' | 'DEFERRED' | 'DISCARD' diff --git a/pkg/sql/parser/sql.y b/pkg/sql/parser/sql.y index c507449fef98..0f5b0f65a89b 100644 --- a/pkg/sql/parser/sql.y +++ b/pkg/sql/parser/sql.y @@ -530,7 +530,7 @@ func newNameFromStr(s string) *tree.Name { %token BLOB BOOL BOOLEAN BOTH BY BYTEA BYTES %token CACHE CANCEL CASCADE CASE CAST CHANGEFEED CHAR -%token CHARACTER CHARACTERISTICS CHECK +%token CHARACTER CHARACTERISTICS CHECK CLOSE %token CLUSTER COALESCE COLLATE COLLATION COLUMN COLUMNS COMMENT COMMIT %token COMMITTED COMPACT COMPLETE CONCAT CONFIGURATION CONFIGURATIONS CONFIGURE %token CONFLICT CONSTRAINT CONSTRAINTS CONTAINS CONVERSION COPY COVERING CREATE CREATEROLE @@ -539,7 +539,7 @@ func newNameFromStr(s string) *tree.Name { %token CURRENT_USER CYCLE %token DATA DATABASE DATABASES DATE DAY DEC DECIMAL DEFAULT -%token DEALLOCATE DEFERRABLE DEFERRED DELETE DESC +%token DEALLOCATE DECLARE DEFERRABLE DEFERRED DELETE DESC %token DISCARD DISTINCT DO DOMAIN DOUBLE DROP %token ELSE ENCODING END ENUM ESCAPE EXCEPT EXCLUDE @@ -807,6 +807,9 @@ func newNameFromStr(s string) *tree.Name { %type upsert_stmt %type use_stmt +%type close_cursor_stmt +%type declare_cursor_stmt + %type <[]string> opt_incremental %type kv_option %type <[]tree.KVOption> kv_option_list opt_with_options var_set_list @@ -849,7 +852,7 @@ func newNameFromStr(s string) *tree.Name { %type <*tree.UnresolvedName> func_name %type opt_collate -%type database_name index_name opt_index_name column_name insert_column_item statistics_name window_name +%type cursor_name database_name index_name opt_index_name column_name insert_column_item statistics_name window_name %type family_name opt_family_name table_alias_name constraint_name target_name zone_name partition_name collation_name %type db_object_name_component %type <*tree.UnresolvedObjectName> table_name standalone_index_name sequence_name type_name view_name db_object_name simple_db_object_name complex_db_object_name @@ -1140,6 +1143,8 @@ stmt: | release_stmt // EXTEND WITH HELP: RELEASE | nonpreparable_set_stmt // help texts in sub-rule | transaction_stmt // help texts in sub-rule +| close_cursor_stmt +| declare_cursor_stmt | /* EMPTY */ { $$.val = tree.Statement(nil) @@ -3399,6 +3404,15 @@ show_stmt: | show_zone_stmt | SHOW error // SHOW HELP: SHOW +// Cursors are not yet supported by CockroachDB. CLOSE ALL is safe to no-op +// since there will be no open cursors. +close_cursor_stmt: + CLOSE ALL { } +| CLOSE cursor_name { return unimplementedWithIssue(sqllex, 41412) } + +declare_cursor_stmt: + DECLARE { return unimplementedWithIssue(sqllex, 41412) } + // %Help: SHOW SESSION - display session variables // %Category: Cfg // %Text: SHOW [SESSION] { | ALL } @@ -9556,6 +9570,8 @@ standalone_index_name: db_object_name explain_option_name: non_reserved_word +cursor_name: name + // Names for column references. // Accepted patterns: // @@ -9757,6 +9773,7 @@ unreserved_keyword: | CANCEL | CASCADE | CHANGEFEED +| CLOSE | CLUSTER | COLUMNS | COMMENT @@ -9782,6 +9799,7 @@ unreserved_keyword: | DATE | DAY | DEALLOCATE +| DECLARE | DELETE | DEFERRED | DISCARD