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 d3b8df075e7d..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 '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 e99459173703..f512e82683a4 100644 --- a/docs/generated/sql/bnf/stmt_block.bnf +++ b/docs/generated/sql/bnf/stmt_block.bnf @@ -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,12 +1845,10 @@ 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 'NONVOTERS' 'FROM' iconst64 'TO' iconst64 'FOR' select_stmt | 'ALTER' 'RANGE' iconst64 relocate_kw 'NONVOTERS' 'FROM' iconst64 'TO' iconst64 diff --git a/pkg/sql/parser/sql.y b/pkg/sql/parser/sql.y index 85d1f62a5800..cdd9457ba48b 100644 --- a/pkg/sql/parser/sql.y +++ b/pkg/sql/parser/sql.y @@ -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 @@ -1577,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 @@ -1796,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 @@ -1823,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 @@ -1940,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 @@ -1952,21 +1956,7 @@ alter_relocate_index_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} @@ -1980,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{ @@ -2001,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(),