Don't uselessly escape a string that doesn't need escaping
authorAlvaro Herrera
Fri, 26 Jul 2019 21:46:40 +0000 (17:46 -0400)
committerAlvaro Herrera
Fri, 26 Jul 2019 21:46:40 +0000 (17:46 -0400)
Per gripe from Ian Barwick

Co-authored-by: Ian Barwick
Discussion: https://postgr.es/m/CABvVfJWNnNKb8cHsTLhkTsvL1+G6BVcV+57+w1JZ61p8YGPdWQ@mail.gmail.com

src/bin/pg_basebackup/pg_basebackup.c

index 77a7c148baed1e3ebdbdd74b0d6e3bb4cc9abe8a..9207109ba3b13f6e7f1c201f8f8b099ebd84c16d 100644 (file)
@@ -1716,9 +1716,9 @@ GenerateRecoveryConf(PGconn *conn)
 
    if (replication_slot)
    {
-       escaped = escape_quotes(replication_slot);
-       appendPQExpBuffer(recoveryconfcontents, "primary_slot_name = '%s'\n", replication_slot);
-       free(escaped);
+       /* unescaped: ReplicationSlotValidateName allows [a-z0-9_] only */
+       appendPQExpBuffer(recoveryconfcontents, "primary_slot_name = '%s'\n",
+                         replication_slot);
    }
 
    if (PQExpBufferBroken(recoveryconfcontents) ||