From 59ab49c7c424249f25be42a5e58e85993d2b7851 Mon Sep 17 00:00:00 2001 From: Oliver Tan Date: Wed, 24 Mar 2021 10:17:59 +1100 Subject: [PATCH] delegate: order AZs in SHOW REGIONS commands Release note (sql change): Availability zones were not ordered when using the SHOW REGIONS set of commands. This has now been changed to be ordered. --- pkg/cli/interactive_tests/test_demo_global.tcl | 7 +++++++ pkg/sql/delegate/show_regions.go | 1 + 2 files changed, 8 insertions(+) diff --git a/pkg/cli/interactive_tests/test_demo_global.tcl b/pkg/cli/interactive_tests/test_demo_global.tcl index 61a4909c33bd..e8b0c77ec368 100644 --- a/pkg/cli/interactive_tests/test_demo_global.tcl +++ b/pkg/cli/interactive_tests/test_demo_global.tcl @@ -13,6 +13,13 @@ spawn $argv demo --empty --nodes 9 --global # Ensure db is defaultdb. eexpect "defaultdb>" +# Ensure regions display correctly. +send "SELECT region, zones FROM \[SHOW REGIONS FROM CLUSTER\] ORDER BY region;\r" +eexpect " europe-west1 | {b,c,d}" +eexpect " us-east1 | {b,c,d}" +eexpect " us-west1 | {a,b,c}" +eexpect "defaultdb>" + interrupt eexpect eof end_test diff --git a/pkg/sql/delegate/show_regions.go b/pkg/sql/delegate/show_regions.go index 29a65bb9dc64..028903b26db4 100644 --- a/pkg/sql/delegate/show_regions.go +++ b/pkg/sql/delegate/show_regions.go @@ -36,6 +36,7 @@ func (d *delegator) delegateShowRegions(n *tree.ShowRegions) (tree.Statement, er 'zone=([^,]*)' ) ) + ORDER BY locality ), NULL )