From e7cc7a65cba3cc049876269e8dcc4d8714919819 Mon Sep 17 00:00:00 2001 From: Oliver Tan Date: Tue, 16 Feb 2021 13:50:15 +1100 Subject: [PATCH] sql: rename SET PRIMARY REGION to PRIMARY REGION as hints Fix hints where SET PRIMARY REGION is suggested into the more "normal" form PRIMARY REGION. Release note: None --- pkg/sql/alter_database.go | 4 ++-- pkg/sql/logictest/testdata/logic_test/multiregion | 6 +++--- pkg/sql/parser/sql.y | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/sql/alter_database.go b/pkg/sql/alter_database.go index b908c746b596..2456f60b0cd8 100644 --- a/pkg/sql/alter_database.go +++ b/pkg/sql/alter_database.go @@ -152,7 +152,7 @@ func (n *alterDatabaseAddRegionNode) startExec(params runParams) error { n.n.Region.String(), n.n.Name.String(), ), - "you must add a PRIMARY REGION first using ALTER DATABASE %s SET PRIMARY REGION %s", + "you must add a PRIMARY REGION first using ALTER DATABASE %s PRIMARY REGION %s", n.n.Name.String(), n.n.Region.String(), ) @@ -308,7 +308,7 @@ func (p *planner) AlterDatabaseDropRegion( return nil, errors.WithHintf( errors.Newf("cannot drop region %q", dbDesc.RegionConfig.PrimaryRegion), "You must designate another region as the primary region using "+ - "ALTER DATABASE %s SET PRIMARY REGION or remove all other regions before "+ + "ALTER DATABASE %s PRIMARY REGION or remove all other regions before "+ "attempting to drop region %q", dbDesc.GetName(), n.Region, ) } diff --git a/pkg/sql/logictest/testdata/logic_test/multiregion b/pkg/sql/logictest/testdata/logic_test/multiregion index ba44af4601fc..2bbd0372eb7d 100644 --- a/pkg/sql/logictest/testdata/logic_test/multiregion +++ b/pkg/sql/logictest/testdata/logic_test/multiregion @@ -881,7 +881,7 @@ ALTER DATABASE non_multi_region_db DROP REGION "ca-central-1" statement ok CREATE DATABASE drop_region_db PRIMARY REGION "ca-central-1" REGIONS "ap-southeast-2", "us-east-1" -statement error pq: cannot drop region "ca-central-1"\nHINT: You must designate another region as the primary region using ALTER DATABASE drop_region_db SET PRIMARY REGION or remove all other regions before attempting to drop region "ca-central-1" +statement error pq: cannot drop region "ca-central-1"\nHINT: You must designate another region as the primary region using ALTER DATABASE drop_region_db PRIMARY REGION or remove all other regions before attempting to drop region "ca-central-1" ALTER DATABASE drop_region_db DROP REGION "ca-central-1" statement ok @@ -931,7 +931,7 @@ CREATE TABLE start_off_non_multi_region.public.t(a INT); ALTER DATABASE start_off_non_multi_region PRIMARY REGION "ca-central-1"; ALTER DATABASE start_off_non_multi_region ADD REGION "ap-southeast-2" -statement error pq: cannot drop region "ca-central-1"\nHINT: You must designate another region as the primary region using ALTER DATABASE start_off_non_multi_region SET PRIMARY REGION or remove all other regions before attempting to drop region "ca-central-1" +statement error pq: cannot drop region "ca-central-1"\nHINT: You must designate another region as the primary region using ALTER DATABASE start_off_non_multi_region PRIMARY REGION or remove all other regions before attempting to drop region "ca-central-1" ALTER DATABASE start_off_non_multi_region DROP REGION "ca-central-1" statement ok @@ -1026,7 +1026,7 @@ statement ok ALTER DATABASE drop_primary_regions_db DROP REGION "ca-central-1" # Cannot drop the primary region yet, as there are other regions in the db. -statement error pq: cannot drop region "us-east-1"\nHINT: You must designate another region as the primary region using ALTER DATABASE drop_primary_regions_db SET PRIMARY REGION or remove all other regions before attempting to drop region "us-east-1" +statement error pq: cannot drop region "us-east-1"\nHINT: You must designate another region as the primary region using ALTER DATABASE drop_primary_regions_db PRIMARY REGION or remove all other regions before attempting to drop region "us-east-1" ALTER DATABASE drop_primary_regions_db DROP REGION "us-east-1" statement ok diff --git a/pkg/sql/parser/sql.y b/pkg/sql/parser/sql.y index 68e555dfface..3230f79a754e 100644 --- a/pkg/sql/parser/sql.y +++ b/pkg/sql/parser/sql.y @@ -1476,7 +1476,7 @@ alter_sequence_options_stmt: // ALTER DATABASE CONVERT TO SCHEMA WITH PARENT // ALTER DATABASE ADD REGIONS // ALTER DATABASE DROP REGIONS -// ALTER DATABASE SET PRIMARY REGION +// ALTER DATABASE PRIMARY REGION // ALTER DATABASE SURVIVE // %SeeAlso: WEBDOCS/alter-database.html alter_database_stmt: