Hi,

pg_dump segfaults if there are more than one DO_PUBLICATION_REL objects to
dump.

create table foo (a int);
create publication foo_pub;
alter publication foo_pub add table foo;

$ pg_dump
<OK>

create table bar (a int);
alter publication foo_pub add table bar;

$ pg_dump -s
Segmentation fault (core dumped)

The reason is DumpableObject.name is not set being set in
getPublicationTables().  Attached patch fixes that.

Thanks,
Amit
>From 384fef77172168452efb22123e01b0a6349683e8 Mon Sep 17 00:00:00 2001
From: amit <amitlangot...@gmail.com>
Date: Mon, 6 Mar 2017 16:44:13 +0900
Subject: [PATCH] Set DumpableObject.name for PublicationRelInfo objects

---
 src/bin/pg_dump/pg_dump.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 7273ec8fe2..83c9b014e7 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -3532,6 +3532,7 @@ getPublicationTables(Archive *fout, TableInfo tblinfo[], int numTables)
 			pubrinfo[j].dobj.catId.oid = atooid(PQgetvalue(res, j, i_oid));
 			AssignDumpId(&pubrinfo[j].dobj);
 			pubrinfo[j].dobj.namespace = tbinfo->dobj.namespace;
+			pubrinfo[j].dobj.name = tbinfo->dobj.name;
 			pubrinfo[j].pubname = pg_strdup(PQgetvalue(res, j, i_pubname));
 			pubrinfo[j].pubtable = tbinfo;
 		}
-- 
2.11.0

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to