diff --git a/pkg/sql/parser/testdata/alter_virtual_cluster b/pkg/sql/parser/testdata/alter_virtual_cluster index 2c78b00c2fa6..9a0c3638bdbd 100644 --- a/pkg/sql/parser/testdata/alter_virtual_cluster +++ b/pkg/sql/parser/testdata/alter_virtual_cluster @@ -258,10 +258,10 @@ ALTER VIRTUAL CLUSTER 'foo' SET REPLICATION RETENTION = '-2h' -- identifiers rem parse ALTER TENANT 'foo' START REPLICATION OF 'bar' ON 'baz' WITH RETENTION = '-1h' ---- -ALTER VIRTUAL CLUSTER 'foo' SET REPLICATION RETENTION = '-1h' -- normalized! -ALTER VIRTUAL CLUSTER ('foo') SET REPLICATION RETENTION = ('-1h') -- fully parenthesized -ALTER VIRTUAL CLUSTER '_' SET REPLICATION RETENTION = '_' -- literals removed -ALTER VIRTUAL CLUSTER 'foo' SET REPLICATION RETENTION = '-1h' -- identifiers removed +ALTER VIRTUAL CLUSTER 'foo' START REPLICATION OF 'bar' ON 'baz' WITH RETENTION = '-1h' -- normalized! +ALTER VIRTUAL CLUSTER ('foo') START REPLICATION OF ('bar') ON ('baz') WITH RETENTION = ('-1h') -- fully parenthesized +ALTER VIRTUAL CLUSTER '_' START REPLICATION OF '_' ON '_' WITH RETENTION = '_' -- literals removed +ALTER VIRTUAL CLUSTER 'foo' START REPLICATION OF 'bar' ON 'baz' WITH RETENTION = '-1h' -- identifiers removed parse ALTER VIRTUAL CLUSTER 'foo' SET REPLICATION EXPIRATION WINDOW = '2h' diff --git a/pkg/sql/sem/tree/alter_tenant.go b/pkg/sql/sem/tree/alter_tenant.go index c5cf0ca283dc..94776b9220f6 100644 --- a/pkg/sql/sem/tree/alter_tenant.go +++ b/pkg/sql/sem/tree/alter_tenant.go @@ -44,12 +44,6 @@ func (n *AlterTenantReplication) Format(ctx *FmtCtx) { ctx.WriteString("SYSTEM TIME ") ctx.FormatNode(n.Cutover.Timestamp) } - } else if !n.Options.IsDefault() { - ctx.WriteString("SET REPLICATION ") - ctx.FormatNode(&n.Options) - } else if n.Command == PauseJob || n.Command == ResumeJob { - ctx.WriteString(JobCommandToStatement[n.Command]) - ctx.WriteString(" REPLICATION") } else if n.ReplicationSourceTenantName != nil { ctx.WriteString("START REPLICATION OF ") ctx.FormatNode(n.ReplicationSourceTenantName) @@ -67,6 +61,12 @@ func (n *AlterTenantReplication) Format(ctx *FmtCtx) { ctx.WriteString(" WITH ") ctx.FormatNode(&n.Options) } + } else if !n.Options.IsDefault() { + ctx.WriteString("SET REPLICATION ") + ctx.FormatNode(&n.Options) + } else if n.Command == PauseJob || n.Command == ResumeJob { + ctx.WriteString(JobCommandToStatement[n.Command]) + ctx.WriteString(" REPLICATION") } }