Fix bogus syntax for CREATE PUBLICATION commands emitted by pg_dump.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 15 May 2017 15:48:39 +0000 (11:48 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 15 May 2017 15:48:39 +0000 (11:48 -0400)
Original coding was careless about where to insert commas.

Masahiko Sawada

Discussion: https://postgr.es/m/3427593a-61aa-b17e-64ef-383b7742d6d9@enterprisedb.com

src/bin/pg_dump/pg_dump.c

index b6794d06dedfb9095b8dd05568c7cf9ad703c6bc..f7b28408b5fa823905bdcd98527ab888a2387899 100644 (file)
@@ -3491,20 +3491,20 @@ dumpPublication(Archive *fout, PublicationInfo *pubinfo)
        first = false;
    }
 
-   if (!first)
-       appendPQExpBufferStr(query, ", ");
-
    if (pubinfo->pubupdate)
    {
+       if (!first)
+           appendPQExpBufferStr(query, ", ");
+
        appendPQExpBufferStr(query, "update");
        first = false;
    }
 
-   if (!first)
-       appendPQExpBufferStr(query, ", ");
-
    if (pubinfo->pubdelete)
    {
+       if (!first)
+           appendPQExpBufferStr(query, ", ");
+
        appendPQExpBufferStr(query, "delete");
        first = false;
    }