diff --git a/docs/generated/sql/bnf/BUILD.bazel b/docs/generated/sql/bnf/BUILD.bazel index 1753d9e74a8c..644cef523a04 100644 --- a/docs/generated/sql/bnf/BUILD.bazel +++ b/docs/generated/sql/bnf/BUILD.bazel @@ -8,6 +8,7 @@ FILES = [ "alter_backup", "alter_backup_schedule", "alter_column", + "alter_database", "alter_database_add_region_stmt", "alter_database_add_super_region", "alter_database_set_secondary_region_stmt", @@ -16,8 +17,10 @@ FILES = [ "alter_database_drop_region", "alter_database_drop_secondary_region", "alter_database_owner", + "alter_database_placement_stmt", "alter_database_primary_region", "alter_database_set_zone_config_extension_stmt", + "alter_database_set_stmt", "alter_database_stmt", "alter_database_survival_goal_stmt", "alter_database_to_schema_stmt", @@ -30,11 +33,13 @@ FILES = [ "alter_func_set_schema_stmt", "alter_func_dep_extension_stmt", "alter_index_partition_by", + "alter_index", "alter_index_stmt", "alter_index_visible_stmt", "alter_partition_stmt", "alter_primary_key", "alter_range_relocate_stmt", + "alter_range", "alter_range_stmt", "alter_rename_view_stmt", "alter_role_stmt", @@ -47,6 +52,7 @@ FILES = [ "alter_sequence_set_schema_stmt", "alter_stmt", "alter_table", + "alter_table_cmds", "alter_table_locality_stmt", "alter_table_owner_stmt", "alter_table_partition_by", diff --git a/docs/generated/sql/bnf/alter_database.bnf b/docs/generated/sql/bnf/alter_database.bnf new file mode 100644 index 000000000000..0cbad4e4722b --- /dev/null +++ b/docs/generated/sql/bnf/alter_database.bnf @@ -0,0 +1,41 @@ +alter_database_stmt ::= + 'ALTER' 'DATABASE' database_name 'RENAME' 'TO' database_new_name + | 'ALTER' 'DATABASE' database_name 'CONFIGURE' 'ZONE' 'USING' variable '=' 'COPY' 'FROM' 'PARENT' ( ( ',' variable '=' value | ',' variable '=' 'COPY' 'FROM' 'PARENT' ) )* + | 'ALTER' 'DATABASE' database_name 'CONFIGURE' 'ZONE' 'USING' variable '=' value ( ( ',' variable '=' value | ',' variable '=' 'COPY' 'FROM' 'PARENT' ) )* + | 'ALTER' 'DATABASE' database_name 'CONFIGURE' 'ZONE' 'DISCARD' + | 'ALTER' 'DATABASE' database_name 'OWNER' 'TO' role_spec + | 'ALTER' 'DATABASE' database_name 'CONVERT' 'TO' 'SCHEMA' 'WITH' 'PARENT' database_name + | 'ALTER' 'DATABASE' database_name 'ADD' 'REGION' region_name + | 'ALTER' 'DATABASE' database_name 'ADD' 'REGION' 'IF' 'NOT' 'EXISTS' region_name + | 'ALTER' 'DATABASE' database_name 'DROP' 'REGION' region_name + | 'ALTER' 'DATABASE' database_name 'DROP' 'REGION' 'IF' 'EXISTS' region_name + | 'ALTER' 'DATABASE' database_name 'SURVIVE' '=' 'REGION' 'FAILURE' + | 'ALTER' 'DATABASE' database_name 'SURVIVE' 'REGION' 'FAILURE' + | 'ALTER' 'DATABASE' database_name 'SURVIVE' '=' 'ZONE' 'FAILURE' + | 'ALTER' 'DATABASE' database_name 'SURVIVE' 'ZONE' 'FAILURE' + | 'ALTER' 'DATABASE' database_name 'PRIMARY' 'REGION' '=' region_name + | 'ALTER' 'DATABASE' database_name 'PRIMARY' 'REGION' region_name + | 'ALTER' 'DATABASE' database_name 'SET' 'PRIMARY' 'REGION' '=' region_name + | 'ALTER' 'DATABASE' database_name 'SET' 'PRIMARY' 'REGION' region_name + | 'ALTER' 'DATABASE' database_name 'PLACEMENT' 'RESTRICTED' + | 'ALTER' 'DATABASE' database_name 'PLACEMENT' 'DEFAULT' + | 'ALTER' 'DATABASE' database_name 'SET' variable '=' value ( ( ',' value ) )* + | 'ALTER' 'DATABASE' database_name 'SET' variable 'TO' value ( ( ',' value ) )* + | 'ALTER' 'DATABASE' database_name 'RESET_ALL' 'ALL' + | 'ALTER' 'DATABASE' database_name 'RESET' session_var + | 'ALTER' 'DATABASE' database_name 'ADD' 'SUPER' 'REGION' region_name 'VALUES' region_name_list + | 'ALTER' 'DATABASE' database_name 'ALTER' 'SUPER' 'REGION' region_name 'VALUES' region_name_list + | 'ALTER' 'DATABASE' database_name 'DROP' 'SUPER' 'REGION' region_name + | 'ALTER' 'DATABASE' database_name 'SET' 'SECONDARY' 'REGION' '=' region_name + | 'ALTER' 'DATABASE' database_name 'SET' 'SECONDARY' 'REGION' region_name + | 'ALTER' 'DATABASE' database_name 'DROP' 'SECONDARY' 'REGION' + | 'ALTER' 'DATABASE' database_name 'DROP' 'SECONDARY' 'REGION' 'IF' 'EXISTS' + | 'ALTER' 'DATABASE' database_name 'ALTER' 'LOCALITY' 'GLOBAL' 'CONFIGURE' 'ZONE' 'USING' variable '=' 'COPY' 'FROM' 'PARENT' ( ( ',' variable '=' value | ',' variable '=' 'COPY' 'FROM' 'PARENT' ) )* + | 'ALTER' 'DATABASE' database_name 'ALTER' 'LOCALITY' 'GLOBAL' 'CONFIGURE' 'ZONE' 'USING' variable '=' value ( ( ',' variable '=' value | ',' variable '=' 'COPY' 'FROM' 'PARENT' ) )* + | 'ALTER' 'DATABASE' database_name 'ALTER' 'LOCALITY' 'GLOBAL' 'CONFIGURE' 'ZONE' 'DISCARD' + | 'ALTER' 'DATABASE' database_name 'ALTER' 'LOCALITY' 'REGIONAL' 'CONFIGURE' 'ZONE' 'USING' variable '=' 'COPY' 'FROM' 'PARENT' ( ( ',' variable '=' value | ',' variable '=' 'COPY' 'FROM' 'PARENT' ) )* + | 'ALTER' 'DATABASE' database_name 'ALTER' 'LOCALITY' 'REGIONAL' 'CONFIGURE' 'ZONE' 'USING' variable '=' value ( ( ',' variable '=' value | ',' variable '=' 'COPY' 'FROM' 'PARENT' ) )* + | 'ALTER' 'DATABASE' database_name 'ALTER' 'LOCALITY' 'REGIONAL' 'CONFIGURE' 'ZONE' 'DISCARD' + | 'ALTER' 'DATABASE' database_name 'ALTER' 'LOCALITY' 'REGIONAL' 'IN' region_name 'CONFIGURE' 'ZONE' 'USING' variable '=' 'COPY' 'FROM' 'PARENT' ( ( ',' variable '=' value | ',' variable '=' 'COPY' 'FROM' 'PARENT' ) )* + | 'ALTER' 'DATABASE' database_name 'ALTER' 'LOCALITY' 'REGIONAL' 'IN' region_name 'CONFIGURE' 'ZONE' 'USING' variable '=' value ( ( ',' variable '=' value | ',' variable '=' 'COPY' 'FROM' 'PARENT' ) )* + | 'ALTER' 'DATABASE' database_name 'ALTER' 'LOCALITY' 'REGIONAL' 'IN' region_name 'CONFIGURE' 'ZONE' 'DISCARD' diff --git a/docs/generated/sql/bnf/alter_database_placement_stmt.bnf b/docs/generated/sql/bnf/alter_database_placement_stmt.bnf new file mode 100644 index 000000000000..1758e89ccb7c --- /dev/null +++ b/docs/generated/sql/bnf/alter_database_placement_stmt.bnf @@ -0,0 +1,2 @@ +alter_database_placement_stmt ::= + 'ALTER' 'DATABASE' database_name placement_clause diff --git a/docs/generated/sql/bnf/alter_database_set_stmt.bnf b/docs/generated/sql/bnf/alter_database_set_stmt.bnf new file mode 100644 index 000000000000..58e972cc65d4 --- /dev/null +++ b/docs/generated/sql/bnf/alter_database_set_stmt.bnf @@ -0,0 +1,2 @@ +alter_database_set_stmt ::= + 'ALTER' 'DATABASE' database_name set_or_reset_clause diff --git a/docs/generated/sql/bnf/alter_database_stmt.bnf b/docs/generated/sql/bnf/alter_database_stmt.bnf index 2420dccd7e76..d71b379d8860 100644 --- a/docs/generated/sql/bnf/alter_database_stmt.bnf +++ b/docs/generated/sql/bnf/alter_database_stmt.bnf @@ -7,6 +7,8 @@ alter_database_stmt ::= | alter_database_drop_region_stmt | alter_database_survival_goal_stmt | alter_database_primary_region_stmt + | alter_database_placement_stmt + | alter_database_set_stmt | alter_database_add_super_region | alter_database_alter_super_region | alter_database_drop_super_region diff --git a/docs/generated/sql/bnf/alter_func_stmt.bnf b/docs/generated/sql/bnf/alter_func_stmt.bnf index ade507d19839..3620edcf23c6 100644 --- a/docs/generated/sql/bnf/alter_func_stmt.bnf +++ b/docs/generated/sql/bnf/alter_func_stmt.bnf @@ -1,6 +1,6 @@ alter_func_stmt ::= ( 'ALTER' 'FUNCTION' function_with_paramtypes ( ( ( 'CALLED' 'ON' 'NULL' 'INPUT' | 'RETURNS' 'NULL' 'ON' 'NULL' 'INPUT' | 'STRICT' | 'IMMUTABLE' | 'STABLE' | 'VOLATILE' | 'LEAKPROOF' | 'NOT' 'LEAKPROOF' ) ) ( ( ( 'CALLED' 'ON' 'NULL' 'INPUT' | 'RETURNS' 'NULL' 'ON' 'NULL' 'INPUT' | 'STRICT' | 'IMMUTABLE' | 'STABLE' | 'VOLATILE' | 'LEAKPROOF' | 'NOT' 'LEAKPROOF' ) ) )* ) ( 'RESTRICT' | ) ) - | ( 'ALTER' 'FUNCTION' function_with_paramtypes 'RENAME' 'TO' name ) + | ( 'ALTER' 'FUNCTION' function_with_paramtypes 'RENAME' 'TO' function_new_name ) | ( 'ALTER' 'FUNCTION' function_with_paramtypes 'OWNER' 'TO' role_spec ) | ( 'ALTER' 'FUNCTION' function_with_paramtypes 'SET' 'SCHEMA' schema_name ) | ( 'ALTER' 'FUNCTION' function_with_paramtypes ( 'NO' | ) 'DEPENDS' 'ON' 'EXTENSION' name ) diff --git a/docs/generated/sql/bnf/alter_index.bnf b/docs/generated/sql/bnf/alter_index.bnf new file mode 100644 index 000000000000..ca8ff21d2e4f --- /dev/null +++ b/docs/generated/sql/bnf/alter_index.bnf @@ -0,0 +1,43 @@ +alter_index_stmt ::= + 'ALTER' 'INDEX' table_name '@' index_name 'PARTITION' 'BY' 'LIST' '(' name_list ')' '(' list_partitions ')' ( ( ',' ( ( ( 'PARTITION' 'BY' ( 'LIST' '(' name_list ')' '(' list_partitions ')' | 'RANGE' '(' name_list ')' '(' range_partitions ')' | 'NOTHING' ) ) ) ) ) )* + | 'ALTER' 'INDEX' table_name '@' index_name 'PARTITION' 'BY' 'RANGE' '(' name_list ')' '(' range_partitions ')' ( ( ',' ( ( ( 'PARTITION' 'BY' ( 'LIST' '(' name_list ')' '(' list_partitions ')' | 'RANGE' '(' name_list ')' '(' range_partitions ')' | 'NOTHING' ) ) ) ) ) )* + | 'ALTER' 'INDEX' table_name '@' index_name 'PARTITION' 'BY' 'NOTHING' ( ( ',' ( ( ( 'PARTITION' 'BY' ( 'LIST' '(' name_list ')' '(' list_partitions ')' | 'RANGE' '(' name_list ')' '(' range_partitions ')' | 'NOTHING' ) ) ) ) ) )* + | 'ALTER' 'INDEX' index_name 'PARTITION' 'BY' 'LIST' '(' name_list ')' '(' list_partitions ')' ( ( ',' ( ( ( 'PARTITION' 'BY' ( 'LIST' '(' name_list ')' '(' list_partitions ')' | 'RANGE' '(' name_list ')' '(' range_partitions ')' | 'NOTHING' ) ) ) ) ) )* + | 'ALTER' 'INDEX' index_name 'PARTITION' 'BY' 'RANGE' '(' name_list ')' '(' range_partitions ')' ( ( ',' ( ( ( 'PARTITION' 'BY' ( 'LIST' '(' name_list ')' '(' list_partitions ')' | 'RANGE' '(' name_list ')' '(' range_partitions ')' | 'NOTHING' ) ) ) ) ) )* + | 'ALTER' 'INDEX' index_name 'PARTITION' 'BY' 'NOTHING' ( ( ',' ( ( ( 'PARTITION' 'BY' ( 'LIST' '(' name_list ')' '(' list_partitions ')' | 'RANGE' '(' name_list ')' '(' range_partitions ')' | 'NOTHING' ) ) ) ) ) )* + | 'ALTER' 'INDEX' 'IF' 'EXISTS' table_name '@' index_name 'PARTITION' 'BY' 'LIST' '(' name_list ')' '(' list_partitions ')' ( ( ',' ( ( ( 'PARTITION' 'BY' ( 'LIST' '(' name_list ')' '(' list_partitions ')' | 'RANGE' '(' name_list ')' '(' range_partitions ')' | 'NOTHING' ) ) ) ) ) )* + | 'ALTER' 'INDEX' 'IF' 'EXISTS' table_name '@' index_name 'PARTITION' 'BY' 'RANGE' '(' name_list ')' '(' range_partitions ')' ( ( ',' ( ( ( 'PARTITION' 'BY' ( 'LIST' '(' name_list ')' '(' list_partitions ')' | 'RANGE' '(' name_list ')' '(' range_partitions ')' | 'NOTHING' ) ) ) ) ) )* + | 'ALTER' 'INDEX' 'IF' 'EXISTS' table_name '@' index_name 'PARTITION' 'BY' 'NOTHING' ( ( ',' ( ( ( 'PARTITION' 'BY' ( 'LIST' '(' name_list ')' '(' list_partitions ')' | 'RANGE' '(' name_list ')' '(' range_partitions ')' | 'NOTHING' ) ) ) ) ) )* + | 'ALTER' 'INDEX' 'IF' 'EXISTS' index_name 'PARTITION' 'BY' 'LIST' '(' name_list ')' '(' list_partitions ')' ( ( ',' ( ( ( 'PARTITION' 'BY' ( 'LIST' '(' name_list ')' '(' list_partitions ')' | 'RANGE' '(' name_list ')' '(' range_partitions ')' | 'NOTHING' ) ) ) ) ) )* + | 'ALTER' 'INDEX' 'IF' 'EXISTS' index_name 'PARTITION' 'BY' 'RANGE' '(' name_list ')' '(' range_partitions ')' ( ( ',' ( ( ( 'PARTITION' 'BY' ( 'LIST' '(' name_list ')' '(' list_partitions ')' | 'RANGE' '(' name_list ')' '(' range_partitions ')' | 'NOTHING' ) ) ) ) ) )* + | 'ALTER' 'INDEX' 'IF' 'EXISTS' index_name 'PARTITION' 'BY' 'NOTHING' ( ( ',' ( ( ( 'PARTITION' 'BY' ( 'LIST' '(' name_list ')' '(' list_partitions ')' | 'RANGE' '(' name_list ')' '(' range_partitions ')' | 'NOTHING' ) ) ) ) ) )* + | 'ALTER' 'INDEX' table_name '@' index_name 'SPLIT' 'AT' select_stmt + | 'ALTER' 'INDEX' index_name 'SPLIT' 'AT' select_stmt + | 'ALTER' 'INDEX' table_name '@' index_name 'SPLIT' 'AT' select_stmt 'WITH' 'EXPIRATION' a_expr + | 'ALTER' 'INDEX' index_name 'SPLIT' 'AT' select_stmt 'WITH' 'EXPIRATION' a_expr + | 'ALTER' 'INDEX' table_name '@' index_name 'UNSPLIT' 'AT' select_stmt + | 'ALTER' 'INDEX' index_name 'UNSPLIT' 'AT' select_stmt + | 'ALTER' 'INDEX' table_name '@' index_name 'UNSPLIT' 'ALL' + | 'ALTER' 'INDEX' index_name 'UNSPLIT' 'ALL' + | 'ALTER' 'INDEX' table_name '@' index_name 'RENAME' 'TO' index_new_name + | 'ALTER' 'INDEX' index_name 'RENAME' 'TO' index_new_name + | 'ALTER' 'INDEX' 'IF' 'EXISTS' table_name '@' index_name 'RENAME' 'TO' index_new_name + | 'ALTER' 'INDEX' 'IF' 'EXISTS' index_name 'RENAME' 'TO' index_new_name + | 'ALTER' 'INDEX' table_name '@' index_name 'CONFIGURE' 'ZONE' 'USING' variable '=' 'COPY' 'FROM' 'PARENT' ( ( ',' variable '=' value | ',' variable '=' 'COPY' 'FROM' 'PARENT' ) )* + | 'ALTER' 'INDEX' table_name '@' index_name 'CONFIGURE' 'ZONE' 'USING' variable '=' value ( ( ',' variable '=' value | ',' variable '=' 'COPY' 'FROM' 'PARENT' ) )* + | 'ALTER' 'INDEX' table_name '@' index_name 'CONFIGURE' 'ZONE' 'DISCARD' + | 'ALTER' 'INDEX' index_name 'CONFIGURE' 'ZONE' 'USING' variable '=' 'COPY' 'FROM' 'PARENT' ( ( ',' variable '=' value | ',' variable '=' 'COPY' 'FROM' 'PARENT' ) )* + | 'ALTER' 'INDEX' index_name 'CONFIGURE' 'ZONE' 'USING' variable '=' value ( ( ',' variable '=' value | ',' variable '=' 'COPY' 'FROM' 'PARENT' ) )* + | 'ALTER' 'INDEX' index_name 'CONFIGURE' 'ZONE' 'DISCARD' + | 'ALTER' 'INDEX' table_name '@' index_name 'NOT' 'VISIBLE' + | 'ALTER' 'INDEX' table_name '@' index_name 'INVISIBLE' + | 'ALTER' 'INDEX' table_name '@' index_name 'VISIBLE' + | 'ALTER' 'INDEX' index_name 'NOT' 'VISIBLE' + | 'ALTER' 'INDEX' index_name 'INVISIBLE' + | 'ALTER' 'INDEX' index_name 'VISIBLE' + | 'ALTER' 'INDEX' 'IF' 'EXISTS' table_name '@' index_name 'NOT' 'VISIBLE' + | 'ALTER' 'INDEX' 'IF' 'EXISTS' table_name '@' index_name 'INVISIBLE' + | 'ALTER' 'INDEX' 'IF' 'EXISTS' table_name '@' index_name 'VISIBLE' + | 'ALTER' 'INDEX' 'IF' 'EXISTS' index_name 'NOT' 'VISIBLE' + | 'ALTER' 'INDEX' 'IF' 'EXISTS' index_name 'INVISIBLE' + | 'ALTER' 'INDEX' 'IF' 'EXISTS' index_name 'VISIBLE' diff --git a/docs/generated/sql/bnf/alter_range.bnf b/docs/generated/sql/bnf/alter_range.bnf new file mode 100644 index 000000000000..ceb62388d13a --- /dev/null +++ b/docs/generated/sql/bnf/alter_range.bnf @@ -0,0 +1,12 @@ +alter_range_stmt ::= + 'ALTER' 'RANGE' range_id 'CONFIGURE' 'ZONE' 'USING' var_name '=' 'COPY' 'FROM' 'PARENT' ( ( ',' var_name '=' var_value | ',' var_name '=' 'COPY' 'FROM' 'PARENT' ) )* + | 'ALTER' 'RANGE' range_id 'CONFIGURE' 'ZONE' 'USING' var_name '=' var_value ( ( ',' var_name '=' var_value | ',' var_name '=' 'COPY' 'FROM' 'PARENT' ) )* + | 'ALTER' 'RANGE' range_id 'CONFIGURE' 'ZONE' 'DISCARD' + | 'ALTER' 'RANGE' 'RELOCATE' 'LEASE' 'TO' a_expr 'FOR' select_stmt + | 'ALTER' 'RANGE' range_id 'RELOCATE' 'LEASE' 'TO' a_expr + | 'ALTER' 'RANGE' 'RELOCATE' 'VOTERS' 'FROM' a_expr 'TO' a_expr 'FOR' select_stmt + | 'ALTER' 'RANGE' 'RELOCATE' 'FROM' a_expr 'TO' a_expr 'FOR' select_stmt + | 'ALTER' 'RANGE' 'RELOCATE' 'NONVOTERS' 'FROM' a_expr 'TO' a_expr 'FOR' select_stmt + | 'ALTER' 'RANGE' range_id 'RELOCATE' 'VOTERS' 'FROM' a_expr 'TO' a_expr + | 'ALTER' 'RANGE' range_id 'RELOCATE' 'FROM' a_expr 'TO' a_expr + | 'ALTER' 'RANGE' range_id 'RELOCATE' 'NONVOTERS' 'FROM' a_expr 'TO' a_expr diff --git a/docs/generated/sql/bnf/alter_schema.bnf b/docs/generated/sql/bnf/alter_schema.bnf index 99a437a987e7..35bc68c4fda5 100644 --- a/docs/generated/sql/bnf/alter_schema.bnf +++ b/docs/generated/sql/bnf/alter_schema.bnf @@ -1,3 +1,3 @@ alter_schema_stmt ::= - 'ALTER' 'SCHEMA' ( name | name '.' name ) 'RENAME' 'TO' schema_name + 'ALTER' 'SCHEMA' ( name | name '.' name ) 'RENAME' 'TO' schema_new_name | 'ALTER' 'SCHEMA' ( name | name '.' name ) 'OWNER' 'TO' role_spec diff --git a/docs/generated/sql/bnf/alter_table.bnf b/docs/generated/sql/bnf/alter_table.bnf index 5c8196aa7b3d..3069a8a8a912 100644 --- a/docs/generated/sql/bnf/alter_table.bnf +++ b/docs/generated/sql/bnf/alter_table.bnf @@ -1,3 +1,18 @@ -alter_onetable_stmt ::= - 'ALTER' 'TABLE' table_name ( ( ( 'RENAME' ( 'COLUMN' | ) column_name 'TO' column_name | 'RENAME' 'CONSTRAINT' column_name 'TO' column_name | 'ADD' ( column_name typename col_qual_list ) | 'ADD' 'IF' 'NOT' 'EXISTS' ( column_name typename col_qual_list ) | 'ADD' 'COLUMN' ( column_name typename col_qual_list ) | 'ADD' 'COLUMN' 'IF' 'NOT' 'EXISTS' ( column_name typename col_qual_list ) | 'ALTER' ( 'COLUMN' | ) column_name ( 'SET' 'DEFAULT' a_expr | 'DROP' 'DEFAULT' ) | 'ALTER' ( 'COLUMN' | ) column_name alter_column_on_update | 'ALTER' ( 'COLUMN' | ) column_name 'SET' ('NOT' | ) 'VISIBLE' | 'ALTER' ( 'COLUMN' | ) column_name 'DROP' 'NOT' 'NULL' | 'ALTER' ( 'COLUMN' | ) column_name 'DROP' 'STORED' | 'ALTER' ( 'COLUMN' | ) column_name 'SET' 'NOT' 'NULL' | 'DROP' ( 'COLUMN' | ) 'IF' 'EXISTS' column_name ( 'CASCADE' | 'RESTRICT' | ) | 'DROP' ( 'COLUMN' | ) column_name ( 'CASCADE' | 'RESTRICT' | ) | 'ALTER' ( 'COLUMN' | ) column_name ( 'SET' 'DATA' | ) 'TYPE' typename ( 'COLLATE' collation_name | ) ( 'USING' a_expr | ) | 'ADD' ( 'CONSTRAINT' constraint_name constraint_elem | constraint_elem ) | 'ADD' 'CONSTRAINT' 'IF' 'NOT' 'EXISTS' constraint_name constraint_elem | 'ALTER' 'PRIMARY' 'KEY' 'USING' 'COLUMNS' '(' index_params ')' opt_hash_sharded opt_with_storage_parameter_list | 'VALIDATE' 'CONSTRAINT' constraint_name | 'DROP' 'CONSTRAINT' 'IF' 'EXISTS' constraint_name ( 'CASCADE' | 'RESTRICT' | ) | 'DROP' 'CONSTRAINT' constraint_name ( 'CASCADE' | 'RESTRICT' | ) | 'EXPERIMENTAL_AUDIT' 'SET' audit_mode | partition_by_table | 'SET' '(' storage_parameter_list ')' | 'RESET' '(' storage_parameter_key_list ')' ) ) ( ( ',' ( 'RENAME' ( 'COLUMN' | ) column_name 'TO' column_name | 'RENAME' 'CONSTRAINT' column_name 'TO' column_name | 'ADD' ( column_name typename col_qual_list ) | 'ADD' 'IF' 'NOT' 'EXISTS' ( column_name typename col_qual_list ) | 'ADD' 'COLUMN' ( column_name typename col_qual_list ) | 'ADD' 'COLUMN' 'IF' 'NOT' 'EXISTS' ( column_name typename col_qual_list ) | 'ALTER' ( 'COLUMN' | ) column_name ( 'SET' 'DEFAULT' a_expr | 'DROP' 'DEFAULT' ) | 'ALTER' ( 'COLUMN' | ) column_name alter_column_on_update | 'ALTER' ( 'COLUMN' | ) column_name 'SET' ('NOT' | ) 'VISIBLE' | 'ALTER' ( 'COLUMN' | ) column_name 'DROP' 'NOT' 'NULL' | 'ALTER' ( 'COLUMN' | ) column_name 'DROP' 'STORED' | 'ALTER' ( 'COLUMN' | ) column_name 'SET' 'NOT' 'NULL' | 'DROP' ( 'COLUMN' | ) 'IF' 'EXISTS' column_name ( 'CASCADE' | 'RESTRICT' | ) | 'DROP' ( 'COLUMN' | ) column_name ( 'CASCADE' | 'RESTRICT' | ) | 'ALTER' ( 'COLUMN' | ) column_name ( 'SET' 'DATA' | ) 'TYPE' typename ( 'COLLATE' collation_name | ) ( 'USING' a_expr | ) | 'ADD' ( 'CONSTRAINT' constraint_name constraint_elem | constraint_elem ) | 'ADD' 'CONSTRAINT' 'IF' 'NOT' 'EXISTS' constraint_name constraint_elem | 'ALTER' 'PRIMARY' 'KEY' 'USING' 'COLUMNS' '(' index_params ')' opt_hash_sharded opt_with_storage_parameter_list | 'VALIDATE' 'CONSTRAINT' constraint_name | 'DROP' 'CONSTRAINT' 'IF' 'EXISTS' constraint_name ( 'CASCADE' | 'RESTRICT' | ) | 'DROP' 'CONSTRAINT' constraint_name ( 'CASCADE' | 'RESTRICT' | ) | 'EXPERIMENTAL_AUDIT' 'SET' audit_mode | partition_by_table | 'SET' '(' storage_parameter_list ')' | 'RESET' '(' storage_parameter_key_list ')' ) ) )* ) - | 'ALTER' 'TABLE' 'IF' 'EXISTS' table_name ( ( ( 'RENAME' ( 'COLUMN' | ) column_name 'TO' column_name | 'RENAME' 'CONSTRAINT' column_name 'TO' column_name | 'ADD' ( column_name typename col_qual_list ) | 'ADD' 'IF' 'NOT' 'EXISTS' ( column_name typename col_qual_list ) | 'ADD' 'COLUMN' ( column_name typename col_qual_list ) | 'ADD' 'COLUMN' 'IF' 'NOT' 'EXISTS' ( column_name typename col_qual_list ) | 'ALTER' ( 'COLUMN' | ) column_name ( 'SET' 'DEFAULT' a_expr | 'DROP' 'DEFAULT' ) | 'ALTER' ( 'COLUMN' | ) column_name alter_column_on_update | 'ALTER' ( 'COLUMN' | ) column_name 'SET' ('NOT' | ) 'VISIBLE' | 'ALTER' ( 'COLUMN' | ) column_name 'DROP' 'NOT' 'NULL' | 'ALTER' ( 'COLUMN' | ) column_name 'DROP' 'STORED' | 'ALTER' ( 'COLUMN' | ) column_name 'SET' 'NOT' 'NULL' | 'DROP' ( 'COLUMN' | ) 'IF' 'EXISTS' column_name ( 'CASCADE' | 'RESTRICT' | ) | 'DROP' ( 'COLUMN' | ) column_name ( 'CASCADE' | 'RESTRICT' | ) | 'ALTER' ( 'COLUMN' | ) column_name ( 'SET' 'DATA' | ) 'TYPE' typename ( 'COLLATE' collation_name | ) ( 'USING' a_expr | ) | 'ADD' ( 'CONSTRAINT' constraint_name constraint_elem | constraint_elem ) | 'ADD' 'CONSTRAINT' 'IF' 'NOT' 'EXISTS' constraint_name constraint_elem | 'ALTER' 'PRIMARY' 'KEY' 'USING' 'COLUMNS' '(' index_params ')' opt_hash_sharded opt_with_storage_parameter_list | 'VALIDATE' 'CONSTRAINT' constraint_name | 'DROP' 'CONSTRAINT' 'IF' 'EXISTS' constraint_name ( 'CASCADE' | 'RESTRICT' | ) | 'DROP' 'CONSTRAINT' constraint_name ( 'CASCADE' | 'RESTRICT' | ) | 'EXPERIMENTAL_AUDIT' 'SET' audit_mode | partition_by_table | 'SET' '(' storage_parameter_list ')' | 'RESET' '(' storage_parameter_key_list ')' ) ) ( ( ',' ( 'RENAME' ( 'COLUMN' | ) column_name 'TO' column_name | 'RENAME' 'CONSTRAINT' column_name 'TO' column_name | 'ADD' ( column_name typename col_qual_list ) | 'ADD' 'IF' 'NOT' 'EXISTS' ( column_name typename col_qual_list ) | 'ADD' 'COLUMN' ( column_name typename col_qual_list ) | 'ADD' 'COLUMN' 'IF' 'NOT' 'EXISTS' ( column_name typename col_qual_list ) | 'ALTER' ( 'COLUMN' | ) column_name ( 'SET' 'DEFAULT' a_expr | 'DROP' 'DEFAULT' ) | 'ALTER' ( 'COLUMN' | ) column_name alter_column_on_update | 'ALTER' ( 'COLUMN' | ) column_name 'SET' ('NOT' | ) 'VISIBLE' | 'ALTER' ( 'COLUMN' | ) column_name 'DROP' 'NOT' 'NULL' | 'ALTER' ( 'COLUMN' | ) column_name 'DROP' 'STORED' | 'ALTER' ( 'COLUMN' | ) column_name 'SET' 'NOT' 'NULL' | 'DROP' ( 'COLUMN' | ) 'IF' 'EXISTS' column_name ( 'CASCADE' | 'RESTRICT' | ) | 'DROP' ( 'COLUMN' | ) column_name ( 'CASCADE' | 'RESTRICT' | ) | 'ALTER' ( 'COLUMN' | ) column_name ( 'SET' 'DATA' | ) 'TYPE' typename ( 'COLLATE' collation_name | ) ( 'USING' a_expr | ) | 'ADD' ( 'CONSTRAINT' constraint_name constraint_elem | constraint_elem ) | 'ADD' 'CONSTRAINT' 'IF' 'NOT' 'EXISTS' constraint_name constraint_elem | 'ALTER' 'PRIMARY' 'KEY' 'USING' 'COLUMNS' '(' index_params ')' opt_hash_sharded opt_with_storage_parameter_list | 'VALIDATE' 'CONSTRAINT' constraint_name | 'DROP' 'CONSTRAINT' 'IF' 'EXISTS' constraint_name ( 'CASCADE' | 'RESTRICT' | ) | 'DROP' 'CONSTRAINT' constraint_name ( 'CASCADE' | 'RESTRICT' | ) | 'EXPERIMENTAL_AUDIT' 'SET' audit_mode | partition_by_table | 'SET' '(' storage_parameter_list ')' | 'RESET' '(' storage_parameter_key_list ')' ) ) )* ) +alter_table_stmt ::= + 'ALTER' 'TABLE' table_name alter_table_cmd ( ( ',' alter_table_cmd ) )* + | 'ALTER' 'TABLE' 'IF' 'EXISTS' table_name alter_table_cmd ( ( ',' alter_table_cmd ) )* + | 'ALTER' 'TABLE' table_name 'SPLIT' 'AT' select_stmt + | 'ALTER' 'TABLE' table_name 'SPLIT' 'AT' select_stmt 'WITH' 'EXPIRATION' a_expr + | 'ALTER' 'TABLE' table_name 'UNSPLIT' 'AT' select_stmt + | 'ALTER' 'TABLE' table_name 'UNSPLIT' 'ALL' + | 'ALTER' 'TABLE' table_name 'CONFIGURE' 'ZONE' 'USING' variable '=' 'COPY' 'FROM' 'PARENT' ( ( ',' variable '=' value | ',' variable '=' 'COPY' 'FROM' 'PARENT' ) )* + | 'ALTER' 'TABLE' table_name 'CONFIGURE' 'ZONE' 'USING' variable '=' value ( ( ',' variable '=' value | ',' variable '=' 'COPY' 'FROM' 'PARENT' ) )* + | 'ALTER' 'TABLE' table_name 'CONFIGURE' 'ZONE' 'DISCARD' + | 'ALTER' 'TABLE' table_name 'RENAME' 'TO' table_new_name + | 'ALTER' 'TABLE' 'IF' 'EXISTS' table_name 'RENAME' 'TO' table_new_name + | 'ALTER' 'TABLE' table_name 'SET' 'SCHEMA' schema_name + | 'ALTER' 'TABLE' 'IF' 'EXISTS' table_name 'SET' 'SCHEMA' schema_name + | 'ALTER' 'TABLE' table_name 'SET' locality + | 'ALTER' 'TABLE' 'IF' 'EXISTS' table_name 'SET' locality + | 'ALTER' 'TABLE' table_name 'OWNER' 'TO' role_spec + | 'ALTER' 'TABLE' 'IF' 'EXISTS' table_name 'OWNER' 'TO' role_spec diff --git a/docs/generated/sql/bnf/alter_table_cmds.bnf b/docs/generated/sql/bnf/alter_table_cmds.bnf new file mode 100644 index 000000000000..da7639b6ca8a --- /dev/null +++ b/docs/generated/sql/bnf/alter_table_cmds.bnf @@ -0,0 +1,2 @@ +alter_table_cmds ::= + ( ( 'RENAME' ( 'COLUMN' | ) column_name 'TO' column_new_name | 'RENAME' 'CONSTRAINT' constraint_name 'TO' constraint_new_name | 'ADD' ( column_name typename ( ( ) ( ( col_qualification ) )* ) ) | 'ADD' 'IF' 'NOT' 'EXISTS' ( column_name typename ( ( ) ( ( col_qualification ) )* ) ) | 'ADD' 'COLUMN' ( column_name typename ( ( ) ( ( col_qualification ) )* ) ) | 'ADD' 'COLUMN' 'IF' 'NOT' 'EXISTS' ( column_name typename ( ( ) ( ( col_qualification ) )* ) ) | 'ALTER' ( 'COLUMN' | ) column_name ( 'SET' 'DEFAULT' a_expr | 'DROP' 'DEFAULT' ) | 'ALTER' ( 'COLUMN' | ) column_name ( 'SET' 'ON' 'UPDATE' b_expr | 'DROP' 'ON' 'UPDATE' ) | 'ALTER' ( 'COLUMN' | ) column_name ( 'SET' 'VISIBLE' | 'SET' 'NOT' 'VISIBLE' ) | 'ALTER' ( 'COLUMN' | ) column_name 'DROP' 'NOT' 'NULL' | 'ALTER' ( 'COLUMN' | ) column_name 'DROP' 'STORED' | 'ALTER' ( 'COLUMN' | ) column_name 'SET' 'NOT' 'NULL' | 'DROP' ( 'COLUMN' | ) 'IF' 'EXISTS' column_name ( 'CASCADE' | 'RESTRICT' | ) | 'DROP' ( 'COLUMN' | ) column_name ( 'CASCADE' | 'RESTRICT' | ) | 'ALTER' ( 'COLUMN' | ) column_name ( 'SET' 'DATA' | ) 'TYPE' typename ( 'COLLATE' collation_name | ) ( 'USING' a_expr | ) | 'ADD' ( 'CONSTRAINT' constraint_name constraint_elem | constraint_elem ) ( 'NOT' 'VALID' | ) | 'ADD' 'CONSTRAINT' 'IF' 'NOT' 'EXISTS' constraint_name constraint_elem ( 'NOT' 'VALID' | ) | 'ALTER' 'PRIMARY' 'KEY' 'USING' 'COLUMNS' '(' index_params ')' ( 'USING' 'HASH' | ) ( 'WITH' '(' ( ( ( storage_parameter_key '=' value ) ) ( ( ',' ( storage_parameter_key '=' value ) ) )* ) ')' ) | 'VALIDATE' 'CONSTRAINT' constraint_name | 'DROP' 'CONSTRAINT' 'IF' 'EXISTS' constraint_name ( 'CASCADE' | 'RESTRICT' | ) | 'DROP' 'CONSTRAINT' constraint_name ( 'CASCADE' | 'RESTRICT' | ) | 'EXPERIMENTAL_AUDIT' 'SET' ( 'READ' 'WRITE' | 'OFF' ) | ( ( 'PARTITION' 'BY' ( 'LIST' '(' name_list ')' '(' list_partitions ')' | 'RANGE' '(' name_list ')' '(' range_partitions ')' | 'NOTHING' ) ) | 'PARTITION' 'ALL' 'BY' ( 'LIST' '(' name_list ')' '(' list_partitions ')' | 'RANGE' '(' name_list ')' '(' range_partitions ')' | 'NOTHING' ) ) | 'SET' '(' ( ( ( storage_parameter_key '=' value ) ) ( ( ',' ( storage_parameter_key '=' value ) ) )* ) ')' | 'RESET' '(' ( ( storage_parameter_key ) ( ( ',' storage_parameter_key ) )* ) ')' ) ) ( ( ',' ( 'RENAME' ( 'COLUMN' | ) column_name 'TO' column_new_name | 'RENAME' 'CONSTRAINT' constraint_name 'TO' constraint_new_name | 'ADD' ( column_name typename ( ( ) ( ( col_qualification ) )* ) ) | 'ADD' 'IF' 'NOT' 'EXISTS' ( column_name typename ( ( ) ( ( col_qualification ) )* ) ) | 'ADD' 'COLUMN' ( column_name typename ( ( ) ( ( col_qualification ) )* ) ) | 'ADD' 'COLUMN' 'IF' 'NOT' 'EXISTS' ( column_name typename ( ( ) ( ( col_qualification ) )* ) ) | 'ALTER' ( 'COLUMN' | ) column_name ( 'SET' 'DEFAULT' a_expr | 'DROP' 'DEFAULT' ) | 'ALTER' ( 'COLUMN' | ) column_name ( 'SET' 'ON' 'UPDATE' b_expr | 'DROP' 'ON' 'UPDATE' ) | 'ALTER' ( 'COLUMN' | ) column_name ( 'SET' 'VISIBLE' | 'SET' 'NOT' 'VISIBLE' ) | 'ALTER' ( 'COLUMN' | ) column_name 'DROP' 'NOT' 'NULL' | 'ALTER' ( 'COLUMN' | ) column_name 'DROP' 'STORED' | 'ALTER' ( 'COLUMN' | ) column_name 'SET' 'NOT' 'NULL' | 'DROP' ( 'COLUMN' | ) 'IF' 'EXISTS' column_name ( 'CASCADE' | 'RESTRICT' | ) | 'DROP' ( 'COLUMN' | ) column_name ( 'CASCADE' | 'RESTRICT' | ) | 'ALTER' ( 'COLUMN' | ) column_name ( 'SET' 'DATA' | ) 'TYPE' typename ( 'COLLATE' collation_name | ) ( 'USING' a_expr | ) | 'ADD' ( 'CONSTRAINT' constraint_name constraint_elem | constraint_elem ) ( 'NOT' 'VALID' | ) | 'ADD' 'CONSTRAINT' 'IF' 'NOT' 'EXISTS' constraint_name constraint_elem ( 'NOT' 'VALID' | ) | 'ALTER' 'PRIMARY' 'KEY' 'USING' 'COLUMNS' '(' index_params ')' ( 'USING' 'HASH' | ) ( 'WITH' '(' ( ( ( storage_parameter_key '=' value ) ) ( ( ',' ( storage_parameter_key '=' value ) ) )* ) ')' ) | 'VALIDATE' 'CONSTRAINT' constraint_name | 'DROP' 'CONSTRAINT' 'IF' 'EXISTS' constraint_name ( 'CASCADE' | 'RESTRICT' | ) | 'DROP' 'CONSTRAINT' constraint_name ( 'CASCADE' | 'RESTRICT' | ) | 'EXPERIMENTAL_AUDIT' 'SET' ( 'READ' 'WRITE' | 'OFF' ) | ( ( 'PARTITION' 'BY' ( 'LIST' '(' name_list ')' '(' list_partitions ')' | 'RANGE' '(' name_list ')' '(' range_partitions ')' | 'NOTHING' ) ) | 'PARTITION' 'ALL' 'BY' ( 'LIST' '(' name_list ')' '(' list_partitions ')' | 'RANGE' '(' name_list ')' '(' range_partitions ')' | 'NOTHING' ) ) | 'SET' '(' ( ( ( storage_parameter_key '=' value ) ) ( ( ',' ( storage_parameter_key '=' value ) ) )* ) ')' | 'RESET' '(' ( ( storage_parameter_key ) ( ( ',' storage_parameter_key ) )* ) ')' ) ) )* diff --git a/docs/generated/sql/bnf/alter_view.bnf b/docs/generated/sql/bnf/alter_view.bnf index 7c640c97e891..e249309d2db1 100644 --- a/docs/generated/sql/bnf/alter_view.bnf +++ b/docs/generated/sql/bnf/alter_view.bnf @@ -1,8 +1,8 @@ alter_view_stmt ::= - 'ALTER' 'VIEW' view_name 'RENAME' 'TO' view_name - | 'ALTER' 'MATERIALIZED' 'VIEW' view_name 'RENAME' 'TO' view_name - | 'ALTER' 'VIEW' 'IF' 'EXISTS' view_name 'RENAME' 'TO' view_name - | 'ALTER' 'MATERIALIZED' 'VIEW' 'IF' 'EXISTS' view_name 'RENAME' 'TO' view_name + 'ALTER' 'VIEW' view_name 'RENAME' 'TO' view_new_name + | 'ALTER' 'MATERIALIZED' 'VIEW' view_name 'RENAME' 'TO' view_new_name + | 'ALTER' 'VIEW' 'IF' 'EXISTS' view_name 'RENAME' 'TO' view_new_name + | 'ALTER' 'MATERIALIZED' 'VIEW' 'IF' 'EXISTS' view_name 'RENAME' 'TO' view_new_name | 'ALTER' 'VIEW' view_name 'SET' 'SCHEMA' schema_name | 'ALTER' 'MATERIALIZED' 'VIEW' view_name 'SET' 'SCHEMA' schema_name | 'ALTER' 'VIEW' 'IF' 'EXISTS' view_name 'SET' 'SCHEMA' schema_name diff --git a/docs/generated/sql/bnf/create_database_stmt.bnf b/docs/generated/sql/bnf/create_database_stmt.bnf index 3e80adca36a1..9cf306e97eb1 100644 --- a/docs/generated/sql/bnf/create_database_stmt.bnf +++ b/docs/generated/sql/bnf/create_database_stmt.bnf @@ -1,3 +1,3 @@ create_database_stmt ::= - 'CREATE' 'DATABASE' database_name ( 'WITH' | ) opt_template_clause ( 'ENCODING' ( '=' | ) encoding | ) opt_lc_collate_clause opt_lc_ctype_clause ( 'CONNECTION' 'LIMIT' ( '=' | ) limit | ) ( ( 'PRIMARY' 'REGION' ( '=' | ) region_name ) | ) ( ( 'REGIONS' ) ( '=' | ) region_name_list | ) ( ( 'SURVIVE' ( '=' | ) 'REGION' 'FAILURE' | 'SURVIVE' ( '=' | ) 'ZONE' 'FAILURE' ) | ) opt_owner_clause opt_super_region_clause opt_secondary_region_clause - | 'CREATE' 'DATABASE' 'IF' 'NOT' 'EXISTS' database_name ( 'WITH' | ) opt_template_clause ( 'ENCODING' ( '=' | ) encoding | ) opt_lc_collate_clause opt_lc_ctype_clause ( 'CONNECTION' 'LIMIT' ( '=' | ) limit | ) ( ( 'PRIMARY' 'REGION' ( '=' | ) region_name ) | ) ( ( 'REGIONS' ) ( '=' | ) region_name_list | ) ( ( 'SURVIVE' ( '=' | ) 'REGION' 'FAILURE' | 'SURVIVE' ( '=' | ) 'ZONE' 'FAILURE' ) | ) opt_super_region_clause opt_secondary_region_clause + 'CREATE' 'DATABASE' database_name ( 'WITH' | ) opt_template_clause ( 'ENCODING' ( '=' | ) encoding | ) opt_lc_collate_clause opt_lc_ctype_clause ( 'CONNECTION' 'LIMIT' ( '=' | ) limit | ) ( ( 'PRIMARY' 'REGION' ( '=' | ) region_name ) | ) ( ( 'REGIONS' ) ( '=' | ) region_name_list | ) ( ( 'SURVIVE' ( '=' | ) 'REGION' 'FAILURE' | 'SURVIVE' ( '=' | ) 'ZONE' 'FAILURE' ) | ) opt_placement_clause opt_owner_clause opt_super_region_clause opt_secondary_region_clause + | 'CREATE' 'DATABASE' 'IF' 'NOT' 'EXISTS' database_name ( 'WITH' | ) opt_template_clause ( 'ENCODING' ( '=' | ) encoding | ) opt_lc_collate_clause opt_lc_ctype_clause ( 'CONNECTION' 'LIMIT' ( '=' | ) limit | ) ( ( 'PRIMARY' 'REGION' ( '=' | ) region_name ) | ) ( ( 'REGIONS' ) ( '=' | ) region_name_list | ) ( ( 'SURVIVE' ( '=' | ) 'REGION' 'FAILURE' | 'SURVIVE' ( '=' | ) 'ZONE' 'FAILURE' ) | ) opt_placement_clause opt_super_region_clause opt_secondary_region_clause diff --git a/docs/generated/sql/bnf/stmt_block.bnf b/docs/generated/sql/bnf/stmt_block.bnf index 62735d5dc9be..3ccf1474840e 100644 --- a/docs/generated/sql/bnf/stmt_block.bnf +++ b/docs/generated/sql/bnf/stmt_block.bnf @@ -1588,6 +1588,8 @@ alter_database_stmt ::= | alter_database_drop_region_stmt | alter_database_survival_goal_stmt | alter_database_primary_region_stmt + | alter_database_placement_stmt + | alter_database_set_stmt | alter_database_add_super_region | alter_database_alter_super_region | alter_database_drop_super_region @@ -1669,8 +1671,8 @@ for_schedules_clause ::= | 'FOR' 'SCHEDULE' a_expr create_database_stmt ::= - 'CREATE' 'DATABASE' database_name opt_with opt_template_clause opt_encoding_clause opt_lc_collate_clause opt_lc_ctype_clause opt_connection_limit opt_primary_region_clause opt_regions_list opt_survival_goal_clause opt_owner_clause opt_super_region_clause opt_secondary_region_clause - | 'CREATE' 'DATABASE' 'IF' 'NOT' 'EXISTS' database_name opt_with opt_template_clause opt_encoding_clause opt_lc_collate_clause opt_lc_ctype_clause opt_connection_limit opt_primary_region_clause opt_regions_list opt_survival_goal_clause opt_super_region_clause opt_secondary_region_clause + 'CREATE' 'DATABASE' database_name opt_with opt_template_clause opt_encoding_clause opt_lc_collate_clause opt_lc_ctype_clause opt_connection_limit opt_primary_region_clause opt_regions_list opt_survival_goal_clause opt_placement_clause opt_owner_clause opt_super_region_clause opt_secondary_region_clause + | 'CREATE' 'DATABASE' 'IF' 'NOT' 'EXISTS' database_name opt_with opt_template_clause opt_encoding_clause opt_lc_collate_clause opt_lc_ctype_clause opt_connection_limit opt_primary_region_clause opt_regions_list opt_survival_goal_clause opt_placement_clause opt_super_region_clause opt_secondary_region_clause create_index_stmt ::= 'CREATE' opt_unique 'INDEX' opt_concurrently opt_index_name 'ON' table_name opt_index_access_method '(' index_params ')' opt_hash_sharded opt_storing opt_partition_by_index opt_with_storage_parameter_list opt_where_clause opt_index_visible @@ -2143,6 +2145,12 @@ alter_database_primary_region_stmt ::= 'ALTER' 'DATABASE' database_name primary_region_clause | 'ALTER' 'DATABASE' database_name 'SET' primary_region_clause +alter_database_placement_stmt ::= + 'ALTER' 'DATABASE' database_name placement_clause + +alter_database_set_stmt ::= + 'ALTER' 'DATABASE' database_name set_or_reset_clause + alter_database_add_super_region ::= 'ALTER' 'DATABASE' database_name 'ADD' 'SUPER' 'REGION' name 'VALUES' name_list @@ -2309,6 +2317,10 @@ opt_survival_goal_clause ::= survival_goal_clause | +opt_placement_clause ::= + placement_clause + | + opt_owner_clause ::= 'OWNER' opt_equal role_spec | @@ -2808,6 +2820,10 @@ survival_goal_clause ::= primary_region_clause ::= 'PRIMARY' 'REGION' opt_equal region_name +placement_clause ::= + 'PLACEMENT' 'RESTRICTED' + | 'PLACEMENT' 'DEFAULT' + secondary_region_clause ::= 'SECONDARY' 'REGION' opt_equal region_name diff --git a/pkg/cmd/docgen/diagrams.go b/pkg/cmd/docgen/diagrams.go index ef0d8f3622bf..759536df3ef0 100644 --- a/pkg/cmd/docgen/diagrams.go +++ b/pkg/cmd/docgen/diagrams.go @@ -399,6 +399,16 @@ var specs = []stmtSpec{ exclude: []*regexp.Regexp{regexp.MustCompile("relation_expr 'ALTER' 'PRIMARY' 'KEY' ")}, unlink: []string{"table_name"}, }, + { + name: "alter_database", + stmt: "alter_database_stmt", + inline: []string{"alter_rename_database_stmt", "alter_zone_database_stmt", "alter_database_owner", "alter_database_to_schema_stmt", "alter_database_add_region_stmt", "alter_database_drop_region_stmt", "alter_database_survival_goal_stmt", "alter_database_set_stmt", "alter_database_primary_region_stmt", "alter_database_placement_stmt", "opt_equal", "alter_database_add_super_region", "alter_database_alter_super_region", "alter_database_drop_super_region", "alter_database_set_secondary_region_stmt", "alter_database_drop_secondary_region", "alter_database_set_zone_config_extension_stmt", "set_zone_config", "var_set_list", "survival_goal_clause", "primary_region_clause", "placement_clause", "secondary_region_clause", "set_or_reset_clause", "set_rest", "generic_set", "var_list", "to_or_eq"}, + replace: map[string]string{"'RENAME' 'TO' database_name": "'RENAME' 'TO' database_new_name", "'SUPER' 'REGION' name": "'SUPER' 'REGION' region_name", "'VALUES' name_list": "'VALUES' region_name_list", "var_name": "variable", "var_value": "value"}, + unlink: []string{"database_new_name", "region_name_list", "variable", "value"}, + }, + { + name: "alter_database_stmt", + }, { name: "alter_database_primary_region", stmt: "alter_database_primary_region_stmt", @@ -413,6 +423,31 @@ var specs = []stmtSpec{ inline: []string{"opt_for_roles", "role_or_group_or_user", "name_list", "opt_in_schemas", "schema_name_list", "abbreviated_grant_stmt", "opt_with_grant_option", "target_object_type", "abbreviated_revoke_stmt", "opt_drop_behavior"}, nosplit: true, }, + { + name: "alter_index", + stmt: "alter_index_stmt", + inline: []string{"alter_oneindex_stmt", "alter_index_cmds", "alter_index_cmd", "partition_by_index", "partition_by_inner", "partition_by", "table_index_name", "alter_split_index_stmt", "alter_unsplit_index_stmt", "alter_rename_index_stmt", "alter_zone_index_stmt", "var_set_list", "alter_index_visible_stmt", "set_zone_config", "alter_index_visible"}, + exclude: []*regexp.Regexp{regexp.MustCompile("alter_scatter_index_stmt")}, + replace: map[string]string{"standalone_index_name": "index_name", "var_name": "variable", "var_value": "value", "'RENAME' 'TO' index_name": "'RENAME' 'TO' index_new_name"}, + unlink: []string{"index_new_name", "variable", "value"}, + }, + { + name: "alter_index_stmt", + }, + { + name: "alter_range", + stmt: "alter_range_stmt", + inline: []string{"alter_zone_range_stmt", "alter_range_relocate_stmt", "var_set_list", "set_zone_config", "relocate_kw", "relocate_subject_nonlease"}, + exclude: []*regexp.Regexp{ + regexp.MustCompile("TESTING_RELOCATE"), + regexp.MustCompile("EXPERIMENTAL_RELOCATE"), + }, + replace: map[string]string{"'RANGE' a_expr": "'RANGE' range_id"}, + unlink: []string{"range_id"}, + }, + { + name: "alter_range_stmt", + }, { name: "alter_table_reset_storage_param", stmt: "alter_onetable_stmt", @@ -485,7 +520,8 @@ var specs = []stmtSpec{ { name: "alter_func_stmt", inline: []string{"alter_func_options_stmt", "alter_func_rename_stmt", "alter_func_owner_stmt", "alter_func_set_schema_stmt", "alter_func_dep_extension_stmt", "alter_func_opt_list", "common_func_opt_item", "opt_restrict", "opt_no"}, - unlink: []string{"alter_func_options_stmt", "alter_func_rename_stmt", "alter_func_owner_stmt", "alter_func_set_schema_stmt", "alter_func_dep_extension_stmt", "alter_func_opt_list", "common_func_opt_item", "opt_restrict", "opt_no"}, + replace: map[string]string{"'RENAME' 'TO' name": "'RENAME' 'TO' function_new_name"}, + unlink: []string{"alter_func_options_stmt", "alter_func_rename_stmt", "alter_func_owner_stmt", "alter_func_set_schema_stmt", "alter_func_dep_extension_stmt", "alter_func_opt_list", "common_func_opt_item", "opt_restrict", "opt_no", "function_new_name"}, nosplit: true, }, { @@ -501,6 +537,8 @@ var specs = []stmtSpec{ name: "alter_schema", stmt: "alter_schema_stmt", inline: []string{"qualifiable_schema_name"}, + replace: map[string]string{"schema_name": "schema_new_name"}, + unlink: []string{"schema_new_name"}, nosplit: true, }, { @@ -512,16 +550,21 @@ var specs = []stmtSpec{ nosplit: true, }, { - name: "alter_table", - stmt: "alter_onetable_stmt", - inline: []string{"alter_table_cmds", "alter_table_cmd", "column_table_def", "opt_drop_behavior", "alter_column_default", "opt_column", "opt_set_data", "table_constraint", "opt_collate", "opt_alter_column_using"}, - replace: map[string]string{ - "'VALIDATE' 'CONSTRAINT' name": "", - "opt_validate_behavior": "", - "relation_expr": "table_name", - "alter_column_visible": "'SET' ('NOT' | ) 'VISIBLE'", - }, - unlink: []string{"table_name"}, + name: "alter_table", + stmt: "alter_table_stmt", + inline: []string{"alter_onetable_stmt", "alter_table_cmds", "alter_split_stmt", "alter_unsplit_stmt", "alter_zone_table_stmt", "alter_rename_table_stmt", "alter_table_set_schema_stmt", "alter_table_locality_stmt", "alter_table_owner_stmt", "set_zone_config", "var_set_list"}, + exclude: []*regexp.Regexp{regexp.MustCompile("alter_scatter_stmt")}, + replace: map[string]string{"relation_expr": "table_name", "'RENAME' 'TO' table_name": "'RENAME' 'TO' table_new_name", "var_name": "variable", "var_value": "value"}, + unlink: []string{"table_name", "table_new_name", "variable", "value"}, + }, + { + name: "alter_table_stmt", + }, + { + name: "alter_table_cmds", + inline: []string{"alter_table_cmd", "column_table_def", "col_qual_list", "opt_column", "opt_validate_behavior", "table_constraint", "alter_column_default", "alter_column_visible", "opt_set_data", "opt_collate", "opt_alter_column_using", "alter_column_on_update", "opt_hash_sharded", "opt_with_storage_parameter_list", "opt_drop_behavior", "audit_mode", "partition_by", "partition_by_table", "partition_by_inner", "storage_parameter_list", "storage_parameter", "storage_parameter_key_list"}, + replace: map[string]string{"'RENAME' ( 'COLUMN' | ) column_name 'TO' column_name": "'RENAME' ( 'COLUMN' | ) column_name 'TO' column_new_name", "'RENAME' 'CONSTRAINT' column_name 'TO' column_name": "'RENAME' 'CONSTRAINT' constraint_name 'TO' constraint_new_name", "opt_hash_sharded_bucket_count ": "", "var_name": "variable", "var_value": "value"}, + unlink: []string{"column_new_name", "constraint_name", "constraint_new_name", "variable", "value"}, nosplit: true, }, { @@ -535,7 +578,8 @@ var specs = []stmtSpec{ name: "alter_view", stmt: "alter_view_stmt", inline: []string{"alter_rename_view_stmt", "alter_view_set_schema_stmt", "alter_view_owner_stmt", "opt_transaction"}, - replace: map[string]string{"relation_expr": "view_name", "qualified_name": "name"}, unlink: []string{"view_name", "name"}, + replace: map[string]string{"relation_expr": "view_name", "'RENAME' 'TO' view_name": "'RENAME' 'TO' view_new_name"}, + unlink: []string{"view_name", "view_new_name"}, }, { name: "alter_zone_database_stmt", diff --git a/pkg/gen/bnf.bzl b/pkg/gen/bnf.bzl index bd9fc1401e6b..b22742da50e5 100644 --- a/pkg/gen/bnf.bzl +++ b/pkg/gen/bnf.bzl @@ -8,6 +8,7 @@ BNF_SRCS = [ "//docs/generated/sql/bnf:alter_backup_schedule.bnf", "//docs/generated/sql/bnf:alter_changefeed.bnf", "//docs/generated/sql/bnf:alter_column.bnf", + "//docs/generated/sql/bnf:alter_database.bnf", "//docs/generated/sql/bnf:alter_database_add_region_stmt.bnf", "//docs/generated/sql/bnf:alter_database_add_super_region.bnf", "//docs/generated/sql/bnf:alter_database_alter_super_region.bnf", @@ -15,8 +16,10 @@ BNF_SRCS = [ "//docs/generated/sql/bnf:alter_database_drop_secondary_region.bnf", "//docs/generated/sql/bnf:alter_database_drop_super_region.bnf", "//docs/generated/sql/bnf:alter_database_owner.bnf", + "//docs/generated/sql/bnf:alter_database_placement_stmt.bnf", "//docs/generated/sql/bnf:alter_database_primary_region.bnf", "//docs/generated/sql/bnf:alter_database_set_secondary_region_stmt.bnf", + "//docs/generated/sql/bnf:alter_database_set_stmt.bnf", "//docs/generated/sql/bnf:alter_database_set_zone_config_extension_stmt.bnf", "//docs/generated/sql/bnf:alter_database_stmt.bnf", "//docs/generated/sql/bnf:alter_database_survival_goal_stmt.bnf", @@ -29,11 +32,13 @@ BNF_SRCS = [ "//docs/generated/sql/bnf:alter_func_rename_stmt.bnf", "//docs/generated/sql/bnf:alter_func_set_schema_stmt.bnf", "//docs/generated/sql/bnf:alter_func_stmt.bnf", + "//docs/generated/sql/bnf:alter_index.bnf", "//docs/generated/sql/bnf:alter_index_partition_by.bnf", "//docs/generated/sql/bnf:alter_index_stmt.bnf", "//docs/generated/sql/bnf:alter_index_visible_stmt.bnf", "//docs/generated/sql/bnf:alter_partition_stmt.bnf", "//docs/generated/sql/bnf:alter_primary_key.bnf", + "//docs/generated/sql/bnf:alter_range.bnf", "//docs/generated/sql/bnf:alter_range_relocate_stmt.bnf", "//docs/generated/sql/bnf:alter_range_stmt.bnf", "//docs/generated/sql/bnf:alter_rename_view_stmt.bnf", @@ -47,6 +52,7 @@ BNF_SRCS = [ "//docs/generated/sql/bnf:alter_sequence_set_schema_stmt.bnf", "//docs/generated/sql/bnf:alter_stmt.bnf", "//docs/generated/sql/bnf:alter_table.bnf", + "//docs/generated/sql/bnf:alter_table_cmds.bnf", "//docs/generated/sql/bnf:alter_table_locality_stmt.bnf", "//docs/generated/sql/bnf:alter_table_owner_stmt.bnf", "//docs/generated/sql/bnf:alter_table_partition_by.bnf", diff --git a/pkg/gen/diagrams.bzl b/pkg/gen/diagrams.bzl index 99f2c575f3d7..654330faec50 100644 --- a/pkg/gen/diagrams.bzl +++ b/pkg/gen/diagrams.bzl @@ -17,7 +17,9 @@ DIAGRAMS_SRCS = [ "//docs/generated/sql/bnf:alter_database_drop_secondary_region.html", "//docs/generated/sql/bnf:alter_database_drop_super_region.html", "//docs/generated/sql/bnf:alter_database_owner.html", + "//docs/generated/sql/bnf:alter_database_placement.html", "//docs/generated/sql/bnf:alter_database_primary_region.html", + "//docs/generated/sql/bnf:alter_database_set.html", "//docs/generated/sql/bnf:alter_database_set_secondary_region.html", "//docs/generated/sql/bnf:alter_database_set_zone_config_extension.html", "//docs/generated/sql/bnf:alter_database_survival_goal.html", @@ -47,6 +49,7 @@ DIAGRAMS_SRCS = [ "//docs/generated/sql/bnf:alter_sequence_owner.html", "//docs/generated/sql/bnf:alter_sequence_set_schema.html", "//docs/generated/sql/bnf:alter_table.html", + "//docs/generated/sql/bnf:alter_table_cmds.html", "//docs/generated/sql/bnf:alter_table_locality.html", "//docs/generated/sql/bnf:alter_table_owner.html", "//docs/generated/sql/bnf:alter_table_partition_by.html", diff --git a/pkg/gen/docs.bzl b/pkg/gen/docs.bzl index c72f0ad76b98..bad5180e4298 100644 --- a/pkg/gen/docs.bzl +++ b/pkg/gen/docs.bzl @@ -20,6 +20,7 @@ DOCS_SRCS = [ "//docs/generated/sql/bnf:alter_backup_schedule.bnf", "//docs/generated/sql/bnf:alter_changefeed.bnf", "//docs/generated/sql/bnf:alter_column.bnf", + "//docs/generated/sql/bnf:alter_database.bnf", "//docs/generated/sql/bnf:alter_database_add_region_stmt.bnf", "//docs/generated/sql/bnf:alter_database_add_super_region.bnf", "//docs/generated/sql/bnf:alter_database_alter_super_region.bnf", @@ -27,8 +28,10 @@ DOCS_SRCS = [ "//docs/generated/sql/bnf:alter_database_drop_secondary_region.bnf", "//docs/generated/sql/bnf:alter_database_drop_super_region.bnf", "//docs/generated/sql/bnf:alter_database_owner.bnf", + "//docs/generated/sql/bnf:alter_database_placement_stmt.bnf", "//docs/generated/sql/bnf:alter_database_primary_region.bnf", "//docs/generated/sql/bnf:alter_database_set_secondary_region_stmt.bnf", + "//docs/generated/sql/bnf:alter_database_set_stmt.bnf", "//docs/generated/sql/bnf:alter_database_set_zone_config_extension_stmt.bnf", "//docs/generated/sql/bnf:alter_database_stmt.bnf", "//docs/generated/sql/bnf:alter_database_survival_goal_stmt.bnf", @@ -41,11 +44,13 @@ DOCS_SRCS = [ "//docs/generated/sql/bnf:alter_func_rename_stmt.bnf", "//docs/generated/sql/bnf:alter_func_set_schema_stmt.bnf", "//docs/generated/sql/bnf:alter_func_stmt.bnf", + "//docs/generated/sql/bnf:alter_index.bnf", "//docs/generated/sql/bnf:alter_index_partition_by.bnf", "//docs/generated/sql/bnf:alter_index_stmt.bnf", "//docs/generated/sql/bnf:alter_index_visible_stmt.bnf", "//docs/generated/sql/bnf:alter_partition_stmt.bnf", "//docs/generated/sql/bnf:alter_primary_key.bnf", + "//docs/generated/sql/bnf:alter_range.bnf", "//docs/generated/sql/bnf:alter_range_relocate_stmt.bnf", "//docs/generated/sql/bnf:alter_range_stmt.bnf", "//docs/generated/sql/bnf:alter_rename_view_stmt.bnf", @@ -59,6 +64,7 @@ DOCS_SRCS = [ "//docs/generated/sql/bnf:alter_sequence_set_schema_stmt.bnf", "//docs/generated/sql/bnf:alter_stmt.bnf", "//docs/generated/sql/bnf:alter_table.bnf", + "//docs/generated/sql/bnf:alter_table_cmds.bnf", "//docs/generated/sql/bnf:alter_table_locality_stmt.bnf", "//docs/generated/sql/bnf:alter_table_owner_stmt.bnf", "//docs/generated/sql/bnf:alter_table_partition_by.bnf", diff --git a/pkg/sql/parser/sql.y b/pkg/sql/parser/sql.y index 334c9d79f92c..c95f09e7e5ec 100644 --- a/pkg/sql/parser/sql.y +++ b/pkg/sql/parser/sql.y @@ -1965,7 +1965,6 @@ alter_database_owner: alter_database_set_stmt: ALTER DATABASE database_name set_or_reset_clause { - /* SKIP DOC */ $$.val = &tree.AlterRoleSet{ AllRoles: true, DatabaseName: tree.Name($3), @@ -1977,7 +1976,6 @@ alter_database_set_stmt: alter_database_placement_stmt: ALTER DATABASE database_name placement_clause { - /* SKIP DOC */ $$.val = &tree.AlterDatabasePlacement{ Name: tree.Name($3), Placement: $4.dataPlacement(), @@ -11156,12 +11154,10 @@ opt_placement_clause: placement_clause: PLACEMENT RESTRICTED { - /* SKIP DOC */ $$.val = tree.DataPlacementRestricted } | PLACEMENT DEFAULT { - /* SKIP DOC */ $$.val = tree.DataPlacementDefault }