From 323fc5f08e419c7751517b14eb79d224e42c5c10 Mon Sep 17 00:00:00 2001 From: Andrew Farries Date: Fri, 24 Nov 2023 15:10:01 +0000 Subject: [PATCH] Quote table name in `OpSetReplicaIdentity` (#206) Fix table name quoting in the `OpSetReplicaIdentity` operation. This was causing the operation to fail on tables with case-sensitive names. --- pkg/migrations/op_set_replica_identity.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/migrations/op_set_replica_identity.go b/pkg/migrations/op_set_replica_identity.go index 82794a15..bf8e8d83 100644 --- a/pkg/migrations/op_set_replica_identity.go +++ b/pkg/migrations/op_set_replica_identity.go @@ -33,7 +33,9 @@ func (o *OpSetReplicaIdentity) Start(ctx context.Context, conn *sql.DB, stateSch } // set the replica identity on the underlying table - _, err := conn.ExecContext(ctx, fmt.Sprintf("ALTER TABLE %s REPLICA IDENTITY %s", o.Table, identitySQL)) + _, err := conn.ExecContext(ctx, fmt.Sprintf("ALTER TABLE %s REPLICA IDENTITY %s", + pq.QuoteIdentifier(o.Table), + identitySQL)) return err }