From 3b81d82279db630b5336ccc5a6d4ee35fe6f2290 Mon Sep 17 00:00:00 2001 From: Adam Storm Date: Wed, 27 Jan 2021 17:27:49 -0500 Subject: [PATCH] sql: Order SHOW REGIONS FROM DATABASE so PRIMARY REGION is at the top Changed the ordering of the regions in SHOW REGIONS FROM DATABASE so that the PRIMARY REGION is at the top. Release note: None --- pkg/sql/delegate/show_regions.go | 2 +- pkg/sql/logictest/testdata/logic_test/multiregion | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/sql/delegate/show_regions.go b/pkg/sql/delegate/show_regions.go index 708f954e22de..29a65bb9dc64 100644 --- a/pkg/sql/delegate/show_regions.go +++ b/pkg/sql/delegate/show_regions.go @@ -86,7 +86,7 @@ FROM [ WHERE dbs.name = %s ] r LEFT JOIN zones_table ON (r.region = zones_table.region) -ORDER BY region`, +ORDER BY "primary" DESC, "region"`, zonesClause, lex.EscapeSQLString(dbName), ) diff --git a/pkg/sql/logictest/testdata/logic_test/multiregion b/pkg/sql/logictest/testdata/logic_test/multiregion index 80d625a12479..1f6be7701db0 100644 --- a/pkg/sql/logictest/testdata/logic_test/multiregion +++ b/pkg/sql/logictest/testdata/logic_test/multiregion @@ -124,8 +124,8 @@ query TTBT colnames SHOW REGIONS FROM DATABASE ---- database region primary zones -multi_region_test_db ap-southeast-2 false {ap-az1,ap-az2,ap-az3} multi_region_test_db ca-central-1 true {ca-az1,ca-az2,ca-az3} +multi_region_test_db ap-southeast-2 false {ap-az1,ap-az2,ap-az3} multi_region_test_db us-east-1 false {us-az1,us-az2,us-az3} query TTTT colnames @@ -349,8 +349,8 @@ query TTBT colnames show regions from database alter_test_db ---- database region primary zones -alter_test_db ap-southeast-2 false {ap-az1,ap-az2,ap-az3} alter_test_db ca-central-1 true {ca-az1,ca-az2,ca-az3} +alter_test_db ap-southeast-2 false {ap-az1,ap-az2,ap-az3} query TTTT colnames SHOW ENUMS FROM alter_test_db.public @@ -377,8 +377,8 @@ query TTBT colnames show regions from database alter_test_db ---- database region primary zones -alter_test_db ap-southeast-2 false {ap-az1,ap-az2,ap-az3} alter_test_db ca-central-1 true {ca-az1,ca-az2,ca-az3} +alter_test_db ap-southeast-2 false {ap-az1,ap-az2,ap-az3} alter_test_db us-east-1 false {us-az1,us-az2,us-az3} query TTTT colnames @@ -495,8 +495,8 @@ query TTBT colnames show regions from database alter_primary_region_db ---- database region primary zones -alter_primary_region_db ap-southeast-2 false {ap-az1,ap-az2,ap-az3} alter_primary_region_db ca-central-1 true {ca-az1,ca-az2,ca-az3} +alter_primary_region_db ap-southeast-2 false {ap-az1,ap-az2,ap-az3} statement ok ALTER DATABASE alter_primary_region_db PRIMARY REGION "ap-southeast-2"