File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -442,16 +442,25 @@ func (p *planner) AlterDatabaseDropRegion(
442442 )
443443 }
444444
445+ // The system database, once it's been made multi-region, must not be
446+ // allowed to go back.
445447 isSystemDatabase := dbDesc .ID == keys .SystemDatabaseID
446- if allowDrop := allowDropFinalRegion .Get (& p .execCfg .Settings .SV ); ! allowDrop ||
447- // The system database, once it's been made multi-region, must not be
448- // allowed to go back.
449- isSystemDatabase {
448+ if isSystemDatabase {
450449 return nil , pgerror .Newf (
451450 pgcode .InvalidDatabaseDefinition ,
452- "databases in this cluster must have at least 1 region" ,
451+ "cannot drop %s; system database must have at least 1 region" ,
453452 n .Region ,
454- sqlclustersettings .DefaultPrimaryRegionClusterSettingName ,
453+ )
454+ }
455+ if allowDrop := allowDropFinalRegion .Get (& p .execCfg .Settings .SV ); ! allowDrop {
456+ return nil , errors .WithHintf (
457+ pgerror .Newf (
458+ pgcode .InvalidDatabaseDefinition ,
459+ "cannot drop %s; databases in this cluster must have at least 1 region" ,
460+ n .Region ,
461+ ),
462+ "Try enabling the %s cluster setting." ,
463+ allowDropFinalRegion .Name (),
455464 )
456465 }
457466
You can’t perform that action at this time.
0 commit comments