diff --git a/docs/generated/sql/bnf/BUILD.bazel b/docs/generated/sql/bnf/BUILD.bazel index 8f80a01399d4..9be5f5e46728 100644 --- a/docs/generated/sql/bnf/BUILD.bazel +++ b/docs/generated/sql/bnf/BUILD.bazel @@ -18,7 +18,6 @@ FILES = [ "alter_index_stmt", "alter_partition_stmt", "alter_primary_key", - "alter_range_relocate_lease_stmt", "alter_range_relocate_stmt", "alter_range_stmt", "alter_rename_view_stmt", diff --git a/docs/generated/sql/bnf/alter_range_relocate_lease_stmt.bnf b/docs/generated/sql/bnf/alter_range_relocate_lease_stmt.bnf deleted file mode 100644 index 95b9c4bea0c7..000000000000 --- a/docs/generated/sql/bnf/alter_range_relocate_lease_stmt.bnf +++ /dev/null @@ -1,3 +0,0 @@ -alter_range_relocate_lease_stmt ::= - 'ALTER' 'RANGE' relocate_kw 'LEASE' 'TO' iconst64 'FOR' select_stmt - | 'ALTER' 'RANGE' iconst64 relocate_kw 'LEASE' 'TO' iconst64 diff --git a/docs/generated/sql/bnf/alter_range_relocate_stmt.bnf b/docs/generated/sql/bnf/alter_range_relocate_stmt.bnf index af265852b67f..69ce930313d9 100644 --- a/docs/generated/sql/bnf/alter_range_relocate_stmt.bnf +++ b/docs/generated/sql/bnf/alter_range_relocate_stmt.bnf @@ -1,5 +1,7 @@ alter_range_relocate_stmt ::= - 'ALTER' 'RANGE' relocate_kw voters_kw 'FROM' iconst64 'TO' iconst64 'FOR' select_stmt + 'ALTER' 'RANGE' relocate_kw 'LEASE' 'TO' iconst64 'FOR' select_stmt + | 'ALTER' 'RANGE' iconst64 relocate_kw 'LEASE' 'TO' iconst64 + | 'ALTER' 'RANGE' relocate_kw voters_kw 'FROM' iconst64 'TO' iconst64 'FOR' select_stmt | 'ALTER' 'RANGE' iconst64 relocate_kw voters_kw 'FROM' iconst64 'TO' iconst64 - | 'ALTER' 'RANGE' relocate_kw 'NON_VOTERS' 'FROM' iconst64 'TO' iconst64 'FOR' select_stmt - | 'ALTER' 'RANGE' iconst64 relocate_kw 'NON_VOTERS' 'FROM' iconst64 'TO' iconst64 + | 'ALTER' 'RANGE' relocate_kw 'NONVOTERS' 'FROM' iconst64 'TO' iconst64 'FOR' select_stmt + | 'ALTER' 'RANGE' iconst64 relocate_kw 'NONVOTERS' 'FROM' iconst64 'TO' iconst64 diff --git a/docs/generated/sql/bnf/alter_range_stmt.bnf b/docs/generated/sql/bnf/alter_range_stmt.bnf index f77f9af42222..f8a65e7db6c0 100644 --- a/docs/generated/sql/bnf/alter_range_stmt.bnf +++ b/docs/generated/sql/bnf/alter_range_stmt.bnf @@ -1,4 +1,3 @@ alter_range_stmt ::= alter_zone_range_stmt - | alter_range_relocate_lease_stmt | alter_range_relocate_stmt diff --git a/docs/generated/sql/bnf/stmt_block.bnf b/docs/generated/sql/bnf/stmt_block.bnf index 92d70c8a58f5..f512e82683a4 100644 --- a/docs/generated/sql/bnf/stmt_block.bnf +++ b/docs/generated/sql/bnf/stmt_block.bnf @@ -1038,7 +1038,7 @@ unreserved_keyword ::= | 'NOCONTROLJOB' | 'NOLOGIN' | 'NOMODIFYCLUSTERSETTING' - | 'NON_VOTERS' + | 'NONVOTERS' | 'NOVIEWACTIVITY' | 'NOWAIT' | 'NULLS' @@ -1354,7 +1354,6 @@ alter_database_stmt ::= alter_range_stmt ::= alter_zone_range_stmt - | alter_range_relocate_lease_stmt | alter_range_relocate_stmt alter_partition_stmt ::= @@ -1846,15 +1845,13 @@ alter_database_primary_region_stmt ::= alter_zone_range_stmt ::= 'ALTER' 'RANGE' zone_name set_zone_config -alter_range_relocate_lease_stmt ::= +alter_range_relocate_stmt ::= 'ALTER' 'RANGE' relocate_kw 'LEASE' 'TO' iconst64 'FOR' select_stmt | 'ALTER' 'RANGE' iconst64 relocate_kw 'LEASE' 'TO' iconst64 - -alter_range_relocate_stmt ::= - 'ALTER' 'RANGE' relocate_kw voters_kw 'FROM' iconst64 'TO' iconst64 'FOR' select_stmt + | 'ALTER' 'RANGE' relocate_kw voters_kw 'FROM' iconst64 'TO' iconst64 'FOR' select_stmt | 'ALTER' 'RANGE' iconst64 relocate_kw voters_kw 'FROM' iconst64 'TO' iconst64 - | 'ALTER' 'RANGE' relocate_kw 'NON_VOTERS' 'FROM' iconst64 'TO' iconst64 'FOR' select_stmt - | 'ALTER' 'RANGE' iconst64 relocate_kw 'NON_VOTERS' 'FROM' iconst64 'TO' iconst64 + | 'ALTER' 'RANGE' relocate_kw 'NONVOTERS' 'FROM' iconst64 'TO' iconst64 'FOR' select_stmt + | 'ALTER' 'RANGE' iconst64 relocate_kw 'NONVOTERS' 'FROM' iconst64 'TO' iconst64 alter_zone_partition_stmt ::= 'ALTER' 'PARTITION' partition_name 'OF' 'TABLE' table_name set_zone_config diff --git a/pkg/ccl/kvccl/kvfollowerreadsccl/followerreads_test.go b/pkg/ccl/kvccl/kvfollowerreadsccl/followerreads_test.go index 414189919e15..610161725256 100644 --- a/pkg/ccl/kvccl/kvfollowerreadsccl/followerreads_test.go +++ b/pkg/ccl/kvccl/kvfollowerreadsccl/followerreads_test.go @@ -642,7 +642,7 @@ func TestFollowerReadsWithStaleDescriptor(t *testing.T) { // Remove the follower and add a new non-voter to n3. n2 will no longer have a // replica. n1.Exec(t, `ALTER TABLE test EXPERIMENTAL_RELOCATE VOTERS VALUES (ARRAY[1], 1)`) - n1.Exec(t, `ALTER TABLE test EXPERIMENTAL_RELOCATE NON_VOTERS VALUES (ARRAY[3], 1)`) + n1.Exec(t, `ALTER TABLE test EXPERIMENTAL_RELOCATE NONVOTERS VALUES (ARRAY[3], 1)`) // Execute the query again and assert the cache is updated. This query will // not be executed as a follower read since it attempts to use n2 which diff --git a/pkg/sql/opt/optbuilder/testdata/alter_range b/pkg/sql/opt/optbuilder/testdata/alter_range index 0f7b64949019..6e2486ea62d6 100644 --- a/pkg/sql/opt/optbuilder/testdata/alter_range +++ b/pkg/sql/opt/optbuilder/testdata/alter_range @@ -33,7 +33,7 @@ ALTER RANGE RELOCATE FROM 1 TO 2 FOR SELECT c from abc error (42601): RELOCATE data column 1 (range ids) must be of type int, not type string build -ALTER RANGE 1 RELOCATE NON_VOTERS FROM 1 TO 2 +ALTER RANGE 1 RELOCATE NONVOTERS FROM 1 TO 2 ---- alter-range-relocate &{false true 2 1 [3 4 5] []} ├── columns: range_id:3 pretty:4 result:5 @@ -42,7 +42,7 @@ alter-range-relocate &{false true 2 1 [3 4 5] []} └── (1,) build -ALTER RANGE RELOCATE NON_VOTERS FROM 1 TO 2 FOR SELECT a from abc +ALTER RANGE RELOCATE NONVOTERS FROM 1 TO 2 FOR SELECT a from abc ---- alter-range-relocate &{false true 2 1 [3 4 5] []} ├── columns: range_id:3 pretty:4 result:5 diff --git a/pkg/sql/opt/optbuilder/testdata/alter_table b/pkg/sql/opt/optbuilder/testdata/alter_table index 7da02b7d34bc..b9108d4bcc14 100644 --- a/pkg/sql/opt/optbuilder/testdata/alter_table +++ b/pkg/sql/opt/optbuilder/testdata/alter_table @@ -137,7 +137,7 @@ alter-table-relocate abc [voters] └── (ARRAY[4], 2) build -ALTER TABLE abc EXPERIMENTAL_RELOCATE NON_VOTERS VALUES (ARRAY[1,2,3], 1), (ARRAY[4], 2) +ALTER TABLE abc EXPERIMENTAL_RELOCATE NONVOTERS VALUES (ARRAY[1,2,3], 1), (ARRAY[4], 2) ---- alter-table-relocate abc [non-voters] ├── columns: key:1 pretty:2 @@ -167,7 +167,7 @@ alter-table-relocate abc@bc [voters] └── (ARRAY[6,7,8], 2, 'bar') build -ALTER INDEX abc@bc EXPERIMENTAL_RELOCATE NON_VOTERS VALUES (ARRAY[5], 1, 'foo'), (ARRAY[6,7,8], 2, 'bar') +ALTER INDEX abc@bc EXPERIMENTAL_RELOCATE NONVOTERS VALUES (ARRAY[5], 1, 'foo'), (ARRAY[6,7,8], 2, 'bar') ---- alter-table-relocate abc@bc [non-voters] ├── columns: key:1 pretty:2 diff --git a/pkg/sql/parser/sql.y b/pkg/sql/parser/sql.y index 679537e0d99d..cdd9457ba48b 100644 --- a/pkg/sql/parser/sql.y +++ b/pkg/sql/parser/sql.y @@ -815,7 +815,7 @@ func (u *sqlSymUnion) setVar() *tree.SetVar { %token NAN NAME NAMES NATURAL NEVER NEW_DB_NAME NEXT NO NOCANCELQUERY NOCONTROLCHANGEFEED %token NOCONTROLJOB NOCREATEDB NOCREATELOGIN NOCREATEROLE NOLOGIN NOMODIFYCLUSTERSETTING -%token NO_INDEX_JOIN NO_ZIGZAG_JOIN NO_FULL_SCAN NONE NON_VOTERS NORMAL NOT NOTHING NOTNULL +%token NO_INDEX_JOIN NO_ZIGZAG_JOIN NO_FULL_SCAN NONE NONVOTERS NORMAL NOT NOTHING NOTNULL %token NOVIEWACTIVITY NOWAIT NULL NULLIF NULLS NUMERIC %token OF OFF OFFSET OID OIDS OIDVECTOR ON ONLY OPT OPTION OPTIONS OR @@ -903,7 +903,6 @@ func (u *sqlSymUnion) setVar() *tree.SetVar { // ALTER RANGE %type alter_zone_range_stmt -%type alter_range_relocate_lease_stmt %type alter_range_relocate_stmt // ALTER TABLE @@ -913,7 +912,6 @@ func (u *sqlSymUnion) setVar() *tree.SetVar { %type alter_rename_table_stmt %type alter_scatter_stmt %type alter_relocate_stmt -%type alter_relocate_lease_stmt %type alter_zone_table_stmt %type alter_table_set_schema_stmt %type alter_table_locality_stmt @@ -941,7 +939,6 @@ func (u *sqlSymUnion) setVar() *tree.SetVar { %type alter_unsplit_index_stmt %type alter_rename_index_stmt %type alter_relocate_index_stmt -%type alter_relocate_index_lease_stmt %type alter_zone_index_stmt // ALTER VIEW @@ -1553,6 +1550,7 @@ alter_ddl_stmt: // ALTER TABLE ... UNSPLIT ALL // ALTER TABLE ... SCATTER [ FROM ( ) TO ( ) ] // ALTER TABLE ... INJECT STATISTICS ... (experimental) +// ALTER TABLE ... RELOCATE [ LEASE | VOTERS | NONVOTERS ] FOR (experimental) // ALTER TABLE ... PARTITION BY RANGE ( ) ( ) // ALTER TABLE ... PARTITION BY LIST ( ) ( ) // ALTER TABLE ... PARTITION BY NOTHING @@ -1576,7 +1574,6 @@ alter_ddl_stmt: alter_table_stmt: alter_onetable_stmt | alter_relocate_stmt -| alter_relocate_lease_stmt | alter_split_stmt | alter_unsplit_stmt | alter_scatter_stmt @@ -1781,10 +1778,10 @@ alter_database_primary_region_stmt: // // Commands: // ALTER RANGE ... CONFIGURE ZONE -// ALTER RANGE RELOCATE from to FOR -// ALTER RANGE r RELOCATE from to -// ALTER RANGE RELOCATE LEASE to FOR -// ALTER RANGE r RELOCATE LEASE to +// ALTER RANGE RELOCATE { VOTERS | NONVOTERS } FROM TO FOR +// ALTER RANGE r RELOCATE { VOTERS | NONVOTERS } FROM TO +// ALTER RANGE RELOCATE LEASE TO FOR +// ALTER RANGE r RELOCATE LEASE TO // // Zone configurations: // DISCARD @@ -1795,7 +1792,6 @@ alter_database_primary_region_stmt: // %SeeAlso: ALTER TABLE alter_range_stmt: alter_zone_range_stmt -| alter_range_relocate_lease_stmt | alter_range_relocate_stmt | ALTER RANGE error // SHOW HELP: ALTER RANGE @@ -1810,6 +1806,7 @@ alter_range_stmt: // ALTER INDEX ... UNSPLIT AT // ALTER INDEX ... UNSPLIT ALL // ALTER INDEX ... SCATTER [ FROM ( ) TO ( ) ] +// ALTER INDEX ... RELOCATE [ LEASE | VOTERS | NONVOTERS ] FOR // // Zone configurations: // DISCARD @@ -1821,7 +1818,6 @@ alter_range_stmt: alter_index_stmt: alter_oneindex_stmt | alter_relocate_index_stmt -| alter_relocate_index_lease_stmt | alter_split_index_stmt | alter_unsplit_index_stmt | alter_scatter_index_stmt @@ -1928,7 +1924,7 @@ alter_relocate_stmt: Rows: $6.slct(), } } -| ALTER TABLE table_name relocate_kw NON_VOTERS select_stmt +| ALTER TABLE table_name relocate_kw NONVOTERS select_stmt { /* SKIP DOC */ name := $3.unresolvedObjectName().ToTableName() @@ -1938,6 +1934,16 @@ alter_relocate_stmt: RelocateNonVoters: true, } } +| ALTER TABLE table_name relocate_kw LEASE select_stmt + { + /* SKIP DOC */ + name := $3.unresolvedObjectName().ToTableName() + $$.val = &tree.Relocate{ + TableOrIndex: tree.TableIndexName{Table: name}, + Rows: $6.slct(), + RelocateLease: true, + } + } alter_relocate_index_stmt: ALTER INDEX table_index_name relocate_kw voters_kw select_stmt @@ -1945,26 +1951,12 @@ alter_relocate_index_stmt: /* SKIP DOC */ $$.val = &tree.Relocate{TableOrIndex: $3.tableIndexName(), Rows: $6.slct()} } -| ALTER INDEX table_index_name relocate_kw NON_VOTERS select_stmt +| ALTER INDEX table_index_name relocate_kw NONVOTERS select_stmt { /* SKIP DOC */ $$.val = &tree.Relocate{TableOrIndex: $3.tableIndexName(), Rows: $6.slct(), RelocateNonVoters: true} } - -alter_relocate_lease_stmt: - ALTER TABLE table_name relocate_kw LEASE select_stmt - { - /* SKIP DOC */ - name := $3.unresolvedObjectName().ToTableName() - $$.val = &tree.Relocate{ - TableOrIndex: tree.TableIndexName{Table: name}, - Rows: $6.slct(), - RelocateLease: true, - } - } - -alter_relocate_index_lease_stmt: - ALTER INDEX table_index_name relocate_kw LEASE select_stmt +| ALTER INDEX table_index_name relocate_kw LEASE select_stmt { /* SKIP DOC */ $$.val = &tree.Relocate{TableOrIndex: $3.tableIndexName(), Rows: $6.slct(), RelocateLease: true} @@ -1978,7 +1970,7 @@ alter_zone_range_stmt: $$.val = s } -alter_range_relocate_lease_stmt: +alter_range_relocate_stmt: ALTER RANGE relocate_kw LEASE TO iconst64 FOR select_stmt { $$.val = &tree.RelocateRange{ @@ -1999,9 +1991,7 @@ alter_range_relocate_lease_stmt: RelocateNonVoters: false, } } - -alter_range_relocate_stmt: -ALTER RANGE relocate_kw voters_kw FROM iconst64 TO iconst64 FOR select_stmt +| ALTER RANGE relocate_kw voters_kw FROM iconst64 TO iconst64 FOR select_stmt { $$.val = &tree.RelocateRange{ Rows: $10.slct(), @@ -2023,7 +2013,7 @@ ALTER RANGE relocate_kw voters_kw FROM iconst64 TO iconst64 FOR select_stmt RelocateNonVoters: false, } } -| ALTER RANGE relocate_kw NON_VOTERS FROM iconst64 TO iconst64 FOR select_stmt +| ALTER RANGE relocate_kw NONVOTERS FROM iconst64 TO iconst64 FOR select_stmt { $$.val = &tree.RelocateRange{ Rows: $10.slct(), @@ -2033,7 +2023,7 @@ ALTER RANGE relocate_kw voters_kw FROM iconst64 TO iconst64 FOR select_stmt RelocateNonVoters: true, } } -| ALTER RANGE iconst64 relocate_kw NON_VOTERS FROM iconst64 TO iconst64 +| ALTER RANGE iconst64 relocate_kw NONVOTERS FROM iconst64 TO iconst64 { $$.val = &tree.RelocateRange{ Rows: &tree.Select{ @@ -13445,7 +13435,7 @@ unreserved_keyword: | NOCONTROLJOB | NOLOGIN | NOMODIFYCLUSTERSETTING -| NON_VOTERS +| NONVOTERS | NOVIEWACTIVITY | NOWAIT | NULLS diff --git a/pkg/sql/parser/testdata/alter_range b/pkg/sql/parser/testdata/alter_range index 0c3f15e53683..da8310a5da54 100644 --- a/pkg/sql/parser/testdata/alter_range +++ b/pkg/sql/parser/testdata/alter_range @@ -119,12 +119,12 @@ ALTER RANGE RELOCATE VOTERS FROM 3 TO 2 FOR VALUES (_) -- literals removed ALTER RANGE RELOCATE VOTERS FROM 3 TO 2 FOR VALUES (1) -- identifiers removed parse -ALTER RANGE 1 RELOCATE NON_VOTERS FROM 3 TO 2 +ALTER RANGE 1 RELOCATE NONVOTERS FROM 3 TO 2 ---- -ALTER RANGE RELOCATE NON_VOTERS FROM 3 TO 2 FOR VALUES (1) -- normalized! -ALTER RANGE RELOCATE NON_VOTERS FROM 3 TO 2 FOR VALUES ((1)) -- fully parenthesized -ALTER RANGE RELOCATE NON_VOTERS FROM 3 TO 2 FOR VALUES (_) -- literals removed -ALTER RANGE RELOCATE NON_VOTERS FROM 3 TO 2 FOR VALUES (1) -- identifiers removed +ALTER RANGE RELOCATE NONVOTERS FROM 3 TO 2 FOR VALUES (1) -- normalized! +ALTER RANGE RELOCATE NONVOTERS FROM 3 TO 2 FOR VALUES ((1)) -- fully parenthesized +ALTER RANGE RELOCATE NONVOTERS FROM 3 TO 2 FOR VALUES (_) -- literals removed +ALTER RANGE RELOCATE NONVOTERS FROM 3 TO 2 FOR VALUES (1) -- identifiers removed parse ALTER RANGE RELOCATE FROM 3 TO 2 FOR SELECT range_id FROM foo @@ -135,9 +135,9 @@ ALTER RANGE RELOCATE VOTERS FROM 3 TO 2 FOR SELECT range_id FROM foo -- literals ALTER RANGE RELOCATE VOTERS FROM 3 TO 2 FOR SELECT _ FROM _ -- identifiers removed parse -ALTER RANGE RELOCATE NON_VOTERS FROM 3 TO 2 FOR SELECT range_id FROM foo +ALTER RANGE RELOCATE NONVOTERS FROM 3 TO 2 FOR SELECT range_id FROM foo ---- -ALTER RANGE RELOCATE NON_VOTERS FROM 3 TO 2 FOR SELECT range_id FROM foo -ALTER RANGE RELOCATE NON_VOTERS FROM 3 TO 2 FOR SELECT (range_id) FROM foo -- fully parenthesized -ALTER RANGE RELOCATE NON_VOTERS FROM 3 TO 2 FOR SELECT range_id FROM foo -- literals removed -ALTER RANGE RELOCATE NON_VOTERS FROM 3 TO 2 FOR SELECT _ FROM _ -- identifiers removed +ALTER RANGE RELOCATE NONVOTERS FROM 3 TO 2 FOR SELECT range_id FROM foo +ALTER RANGE RELOCATE NONVOTERS FROM 3 TO 2 FOR SELECT (range_id) FROM foo -- fully parenthesized +ALTER RANGE RELOCATE NONVOTERS FROM 3 TO 2 FOR SELECT range_id FROM foo -- literals removed +ALTER RANGE RELOCATE NONVOTERS FROM 3 TO 2 FOR SELECT _ FROM _ -- identifiers removed diff --git a/pkg/sql/parser/testdata/alter_table b/pkg/sql/parser/testdata/alter_table index 43e79b799325..742df3984437 100644 --- a/pkg/sql/parser/testdata/alter_table +++ b/pkg/sql/parser/testdata/alter_table @@ -794,36 +794,36 @@ ALTER TABLE d.a EXPERIMENTAL_RELOCATE VOTERS VALUES (ARRAY[_, _, __more1__], '_' ALTER TABLE _._ EXPERIMENTAL_RELOCATE VOTERS VALUES (ARRAY[1, 2, 3], 'b', 2) -- identifiers removed parse -ALTER TABLE a EXPERIMENTAL_RELOCATE NON_VOTERS VALUES (ARRAY[1], 1) +ALTER TABLE a EXPERIMENTAL_RELOCATE NONVOTERS VALUES (ARRAY[1], 1) ---- -ALTER TABLE a EXPERIMENTAL_RELOCATE NON_VOTERS VALUES (ARRAY[1], 1) -ALTER TABLE a EXPERIMENTAL_RELOCATE NON_VOTERS VALUES ((ARRAY[(1)]), (1)) -- fully parenthesized -ALTER TABLE a EXPERIMENTAL_RELOCATE NON_VOTERS VALUES (ARRAY[_], _) -- literals removed -ALTER TABLE _ EXPERIMENTAL_RELOCATE NON_VOTERS VALUES (ARRAY[1], 1) -- identifiers removed +ALTER TABLE a EXPERIMENTAL_RELOCATE NONVOTERS VALUES (ARRAY[1], 1) +ALTER TABLE a EXPERIMENTAL_RELOCATE NONVOTERS VALUES ((ARRAY[(1)]), (1)) -- fully parenthesized +ALTER TABLE a EXPERIMENTAL_RELOCATE NONVOTERS VALUES (ARRAY[_], _) -- literals removed +ALTER TABLE _ EXPERIMENTAL_RELOCATE NONVOTERS VALUES (ARRAY[1], 1) -- identifiers removed parse -EXPLAIN ALTER TABLE a EXPERIMENTAL_RELOCATE NON_VOTERS TABLE b +EXPLAIN ALTER TABLE a EXPERIMENTAL_RELOCATE NONVOTERS TABLE b ---- -EXPLAIN ALTER TABLE a EXPERIMENTAL_RELOCATE NON_VOTERS TABLE b -EXPLAIN ALTER TABLE a EXPERIMENTAL_RELOCATE NON_VOTERS TABLE b -- fully parenthesized -EXPLAIN ALTER TABLE a EXPERIMENTAL_RELOCATE NON_VOTERS TABLE b -- literals removed -EXPLAIN ALTER TABLE _ EXPERIMENTAL_RELOCATE NON_VOTERS TABLE _ -- identifiers removed +EXPLAIN ALTER TABLE a EXPERIMENTAL_RELOCATE NONVOTERS TABLE b +EXPLAIN ALTER TABLE a EXPERIMENTAL_RELOCATE NONVOTERS TABLE b -- fully parenthesized +EXPLAIN ALTER TABLE a EXPERIMENTAL_RELOCATE NONVOTERS TABLE b -- literals removed +EXPLAIN ALTER TABLE _ EXPERIMENTAL_RELOCATE NONVOTERS TABLE _ -- identifiers removed parse -ALTER TABLE a EXPERIMENTAL_RELOCATE NON_VOTERS SELECT * FROM t +ALTER TABLE a EXPERIMENTAL_RELOCATE NONVOTERS SELECT * FROM t ---- -ALTER TABLE a EXPERIMENTAL_RELOCATE NON_VOTERS SELECT * FROM t -ALTER TABLE a EXPERIMENTAL_RELOCATE NON_VOTERS SELECT (*) FROM t -- fully parenthesized -ALTER TABLE a EXPERIMENTAL_RELOCATE NON_VOTERS SELECT * FROM t -- literals removed -ALTER TABLE _ EXPERIMENTAL_RELOCATE NON_VOTERS SELECT * FROM _ -- identifiers removed +ALTER TABLE a EXPERIMENTAL_RELOCATE NONVOTERS SELECT * FROM t +ALTER TABLE a EXPERIMENTAL_RELOCATE NONVOTERS SELECT (*) FROM t -- fully parenthesized +ALTER TABLE a EXPERIMENTAL_RELOCATE NONVOTERS SELECT * FROM t -- literals removed +ALTER TABLE _ EXPERIMENTAL_RELOCATE NONVOTERS SELECT * FROM _ -- identifiers removed parse -ALTER TABLE d.a EXPERIMENTAL_RELOCATE NON_VOTERS VALUES (ARRAY[1, 2, 3], 'b', 2) +ALTER TABLE d.a EXPERIMENTAL_RELOCATE NONVOTERS VALUES (ARRAY[1, 2, 3], 'b', 2) ---- -ALTER TABLE d.a EXPERIMENTAL_RELOCATE NON_VOTERS VALUES (ARRAY[1, 2, 3], 'b', 2) -ALTER TABLE d.a EXPERIMENTAL_RELOCATE NON_VOTERS VALUES ((ARRAY[(1), (2), (3)]), ('b'), (2)) -- fully parenthesized -ALTER TABLE d.a EXPERIMENTAL_RELOCATE NON_VOTERS VALUES (ARRAY[_, _, __more1__], '_', _) -- literals removed -ALTER TABLE _._ EXPERIMENTAL_RELOCATE NON_VOTERS VALUES (ARRAY[1, 2, 3], 'b', 2) -- identifiers removed +ALTER TABLE d.a EXPERIMENTAL_RELOCATE NONVOTERS VALUES (ARRAY[1, 2, 3], 'b', 2) +ALTER TABLE d.a EXPERIMENTAL_RELOCATE NONVOTERS VALUES ((ARRAY[(1), (2), (3)]), ('b'), (2)) -- fully parenthesized +ALTER TABLE d.a EXPERIMENTAL_RELOCATE NONVOTERS VALUES (ARRAY[_, _, __more1__], '_', _) -- literals removed +ALTER TABLE _._ EXPERIMENTAL_RELOCATE NONVOTERS VALUES (ARRAY[1, 2, 3], 'b', 2) -- identifiers removed parse ALTER TABLE a EXPERIMENTAL_RELOCATE LEASE VALUES (1, 1) diff --git a/pkg/sql/sem/tree/alter_range.go b/pkg/sql/sem/tree/alter_range.go index 2f2482dac39b..0d62b27da688 100644 --- a/pkg/sql/sem/tree/alter_range.go +++ b/pkg/sql/sem/tree/alter_range.go @@ -28,7 +28,7 @@ func (node *RelocateRange) Format(ctx *FmtCtx) { if node.RelocateLease { ctx.WriteString("LEASE ") } else if node.RelocateNonVoters { - ctx.WriteString("NON_VOTERS ") + ctx.WriteString("NONVOTERS ") } else { ctx.WriteString("VOTERS ") } diff --git a/pkg/sql/sem/tree/split.go b/pkg/sql/sem/tree/split.go index ace7a804a2d8..89fb95ce9ba2 100644 --- a/pkg/sql/sem/tree/split.go +++ b/pkg/sql/sem/tree/split.go @@ -91,7 +91,7 @@ func (node *Relocate) Format(ctx *FmtCtx) { if node.RelocateLease { ctx.WriteString("LEASE ") } else if node.RelocateNonVoters { - ctx.WriteString("NON_VOTERS ") + ctx.WriteString("NONVOTERS ") } else { ctx.WriteString("VOTERS ") } diff --git a/pkg/sql/sem/tree/stmt.go b/pkg/sql/sem/tree/stmt.go index 3897300e90d9..cb707f00f053 100644 --- a/pkg/sql/sem/tree/stmt.go +++ b/pkg/sql/sem/tree/stmt.go @@ -972,7 +972,7 @@ func (n *Relocate) StatementTag() string { if n.RelocateLease { return "EXPERIMENTAL_RELOCATE LEASE" } else if n.RelocateNonVoters { - return "EXPERIMENTAL_RELOCATE NON_VOTERS" + return "EXPERIMENTAL_RELOCATE NONVOTERS" } return "EXPERIMENTAL_RELOCATE VOTERS" } @@ -988,7 +988,7 @@ func (n *RelocateRange) StatementTag() string { if n.RelocateLease { return "RELOCATE LEASE" } else if n.RelocateNonVoters { - return "RELOCATE NON_VOTERS" + return "RELOCATE NONVOTERS" } return "RELOCATE VOTERS" }