diff --git a/docs/generated/sql/bnf/create_proc.bnf b/docs/generated/sql/bnf/create_proc.bnf index d70688272c37..792d14e377f6 100644 --- a/docs/generated/sql/bnf/create_proc.bnf +++ b/docs/generated/sql/bnf/create_proc.bnf @@ -1,2 +1,2 @@ create_proc_stmt ::= - 'CREATE' ( 'OR' 'REPLACE' | ) 'PROCEDURE' routine_create_name '(' ( ( ( ( routine_param | routine_param | routine_param ) ) ( ( ',' ( routine_param | routine_param | routine_param ) ) )* ) | ) ')' ( ( ( ( 'AS' routine_body_str | 'LANGUAGE' ( 'SQL' | 'PLPGSQL' ) | ) ) ( ( ( 'AS' routine_body_str | 'LANGUAGE' ( 'SQL' | 'PLPGSQL' ) | ) ) )* ) | ) + 'CREATE' ( 'OR' 'REPLACE' | ) 'PROCEDURE' routine_create_name '(' ( ( ( ( routine_param | routine_param | routine_param ) ) ( ( ',' ( routine_param | routine_param | routine_param ) ) )* ) | ) ')' ( ( ( ( 'AS' routine_body_str | 'LANGUAGE' ( 'SQL' | 'PLPGSQL' ) | ( 'EXTERNAL' 'SECURITY' 'DEFINER' | 'EXTERNAL' 'SECURITY' 'INVOKER' | 'SECURITY' 'DEFINER' | 'SECURITY' 'INVOKER' ) ) ) ( ( ( 'AS' routine_body_str | 'LANGUAGE' ( 'SQL' | 'PLPGSQL' ) | ( 'EXTERNAL' 'SECURITY' 'DEFINER' | 'EXTERNAL' 'SECURITY' 'INVOKER' | 'SECURITY' 'DEFINER' | 'SECURITY' 'INVOKER' ) ) ) )* ) | ) diff --git a/pkg/ccl/backupccl/restore_job.go b/pkg/ccl/backupccl/restore_job.go index 416c7e1a5dc3..f47468347589 100644 --- a/pkg/ccl/backupccl/restore_job.go +++ b/pkg/ccl/backupccl/restore_job.go @@ -1183,6 +1183,7 @@ func createImportingDescriptors( for _, desc := range mutableTables { if desc.GetParentID() == tempSystemDBID { desc.SetPublic() + desc.LocalityConfig = nil } } } @@ -1250,6 +1251,13 @@ func createImportingDescriptors( if db, ok := dbsByID[regionTypeDesc.GetParentID()]; ok { desc := db.DatabaseDesc() + if db.GetName() == restoreTempSystemDB { + t.TypeDesc().Kind = descpb.TypeDescriptor_ENUM + t.TypeDesc().RegionConfig = nil + // TODO(foundations): should these be rewritten instead of blank? Does it matter since we drop the whole DB before the job exits? + t.TypeDesc().ReferencingDescriptorIDs = nil + continue + } if desc.RegionConfig == nil { return errors.AssertionFailedf( "found MULTIREGION_ENUM on non-multi-region database %s", desc.Name) diff --git a/pkg/ccl/backupccl/testdata/backup-restore/multiregion b/pkg/ccl/backupccl/testdata/backup-restore/multiregion index 70c47fbc6df2..bd97c7ce9e2e 100644 --- a/pkg/ccl/backupccl/testdata/backup-restore/multiregion +++ b/pkg/ccl/backupccl/testdata/backup-restore/multiregion @@ -6,7 +6,11 @@ skip-under-duress new-cluster name=s1 allow-implicit-access disable-tenant localities=us-east-1,us-west-1,eu-central-1 ---- +set-cluster-setting setting=sql.multiregion.system_database_multiregion.enabled value=true +---- + exec-sql +ALTER DATABASE system SET PRIMARY REGION "us-east-1"; CREATE DATABASE d PRIMARY REGION "us-east-1" REGIONS "us-west-1", "eu-central-1" SURVIVE REGION FAILURE; CREATE TABLE d.t (x INT); INSERT INTO d.t VALUES (1), (2), (3); diff --git a/pkg/cmd/docgen/diagrams.go b/pkg/cmd/docgen/diagrams.go index f0f69e675e1c..153a9ee694fe 100644 --- a/pkg/cmd/docgen/diagrams.go +++ b/pkg/cmd/docgen/diagrams.go @@ -511,11 +511,14 @@ var specs = []stmtSpec{ nosplit: true, }, { - name: "alter_proc", - stmt: "alter_proc_stmt", - inline: []string{"alter_proc_rename_stmt", "alter_proc_owner_stmt", "alter_proc_set_schema_stmt", "function_with_paramtypes", "func_params", "func_params_list"}, - unlink: []string{"proc_name", "proc_new_name"}, - replace: map[string]string{"db_object_name": "proc_name", "'RENAME' 'TO' name": "'RENAME' 'TO' proc_new_name"}, + name: "alter_proc", + stmt: "alter_proc_stmt", + inline: []string{"alter_proc_rename_stmt", "alter_proc_owner_stmt", "alter_proc_set_schema_stmt", "function_with_paramtypes", "func_params", "func_params_list"}, + unlink: []string{"proc_name", "proc_new_name"}, + replace: map[string]string{ + "db_object_name": "proc_name", + "'RENAME' 'TO' name": "'RENAME' 'TO' proc_new_name", + }, nosplit: true, }, { @@ -843,19 +846,20 @@ var specs = []stmtSpec{ { name: "create_proc", stmt: "create_proc_stmt", - inline: []string{"opt_or_replace", "opt_routine_param_with_default_list", "routine_param_with_default_list", "routine_param_with_default", "opt_create_routine_opt_list", "create_routine_opt_list", "create_routine_opt_item", "routine_as", "opt_link_sym", "create_routine_opt_item", "routine_return_stmt"}, + inline: []string{"opt_or_replace", "opt_routine_param_with_default_list", "routine_param_with_default_list", "routine_param_with_default", "opt_create_routine_opt_list", "common_routine_opt_item", "create_routine_opt_list", "create_routine_opt_item", "routine_as", "opt_link_sym", "create_routine_opt_item", "routine_return_stmt"}, unlink: []string{"routine_body_str"}, replace: map[string]string{ - "'DEFAULT'": "", - "common_routine_opt_item": "", - "'AS'": "'AS' routine_body_str", - "opt_routine_body": "", - "non_reserved_word_or_sconst": "( 'SQL' | 'PLPGSQL' )", - "'RETURN'": "", - "( 'SCONST' ) ( ',' 'SCONST' | )": "", - "'='": "", - "a_expr": "", - "'ATOMIC'": ""}, + "'DEFAULT'": "", + "'AS'": "'AS' routine_body_str", + "opt_routine_body": "", + "'CALLED' 'ON' 'NULL' 'INPUT' | 'RETURNS' 'NULL' 'ON' 'NULL' 'INPUT' | 'STRICT' | 'IMMUTABLE' | 'STABLE' | 'VOLATILE' |": "", + "| 'LEAKPROOF' | 'NOT' 'LEAKPROOF'": "", + "non_reserved_word_or_sconst": "( 'SQL' | 'PLPGSQL' )", + "'RETURN'": "", + "( 'SCONST' ) ( ',' 'SCONST' | )": "", + "'='": "", + "a_expr": "", + "'ATOMIC'": ""}, nosplit: true, }, {