Skip to content

Commit 157239d

Browse files
committed
pg_dump: Fix dumping of slot_name = NONE
It previously wrote out slot_name = '', which was incorrect. Reported-by: Masahiko Sawada <sawada.mshk@gmail.com>
1 parent 6234569 commit 157239d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3763,7 +3763,10 @@ getSubscriptions(Archive *fout)
37633763
subinfo[i].dobj.name = pg_strdup(PQgetvalue(res, i, i_subname));
37643764
subinfo[i].rolname = pg_strdup(PQgetvalue(res, i, i_rolname));
37653765
subinfo[i].subconninfo = pg_strdup(PQgetvalue(res, i, i_subconninfo));
3766-
subinfo[i].subslotname = pg_strdup(PQgetvalue(res, i, i_subslotname));
3766+
if (PQgetisnull(res, i, i_subslotname))
3767+
subinfo[i].subslotname = NULL;
3768+
else
3769+
subinfo[i].subslotname = pg_strdup(PQgetvalue(res, i, i_subslotname));
37673770
subinfo[i].subsynccommit =
37683771
pg_strdup(PQgetvalue(res, i, i_subsynccommit));
37693772
subinfo[i].subpublications =
@@ -3831,7 +3834,10 @@ dumpSubscription(Archive *fout, SubscriptionInfo *subinfo)
38313834
}
38323835

38333836
appendPQExpBuffer(query, " PUBLICATION %s WITH (connect = false, slot_name = ", publications->data);
3834-
appendStringLiteralAH(query, subinfo->subslotname, fout);
3837+
if (subinfo->subslotname)
3838+
appendStringLiteralAH(query, subinfo->subslotname, fout);
3839+
else
3840+
appendPQExpBufferStr(query, "NONE");
38353841

38363842
if (strcmp(subinfo->subsynccommit, "off") != 0)
38373843
appendPQExpBuffer(query, ", synchronous_commit = %s", fmtId(subinfo->subsynccommit));

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy