Skip to content

Commit

Permalink
sql: Order SHOW REGIONS FROM DATABASE so PRIMARY REGION is at the top
Browse files Browse the repository at this point in the history
Changed the ordering of the regions in SHOW REGIONS FROM DATABASE so
that the PRIMARY REGION is at the top.

Release note: None
  • Loading branch information
ajstorm committed Jan 27, 2021
1 parent 470152f commit 3b81d82
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/sql/delegate/show_regions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
Expand Down
8 changes: 4 additions & 4 deletions pkg/sql/logictest/testdata/logic_test/multiregion
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 3b81d82

Please sign in to comment.