On Thu, 23 Jan 2025 at 17:03, Amit Kapila <amit.kapil...@gmail.com> wrote: > > On Thu, Jan 23, 2025 at 11:18 AM Peter Smith <smithpb2...@gmail.com> wrote: > > > > Patch v56-0001 LGTM. > > > > I have pushed this patch with minor modifications (especially I didn't > took Peter Smith's last suggestion to convert some functions to return > enum instead of char as the proposed one was consistent with > subscription side code and avoided casting in the patch). On of the BF > failed > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=crake&dt=2025-01-23%2010%3A17%3A03 > > pg_dump: error: query failed: ERROR: column "publish_gencols_none" > does not exist > LINE 1: ...elete, false AS pubtruncate, false AS pubviaroot, PUBLISH_GE... > ^ > pg_dump: detail: Query was: SELECT p.tableoid, p.oid, p.pubname, > p.pubowner, p.puballtables, p.pubinsert, p.pubupdate, p.pubdelete, > false AS pubtruncate, false AS pubviaroot, PUBLISH_GENCOLS_NONE AS > pubgencols_type FROM pg_publication p > pg_dumpall: error: pg_dump failed on database "template1", exiting > > It is probably the case with dump/restore of previous versions. I'll > look into this.
When dumping from Postgres <=PG17 servers, the query generated for pubgencols_type incorrectly included the macro name instead of the macro value. This resulted in dump failures. This commit fixes the issue by correctly specifying the macro value in the query. The attached patch has the changes for the same. Regards, Vignesh
From 4f7e14e9e8b48a807588e70e942c3d9c2191d386 Mon Sep 17 00:00:00 2001 From: Vignesh <vignes...@gmail.com> Date: Thu, 23 Jan 2025 17:40:41 +0530 Subject: [PATCH] Dump failure with <=PG17 servers: Incorrect pubgencols_type query When dumping from Postgres <=PG17 servers, the query generated for pubgencols_type incorrectly included the macro name instead of the macro value. This resulted in dump failures. This commit fixes the issue by correctly specifying the macro value in the query. --- src/bin/pg_dump/pg_dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 9b840fc400..af857f00c7 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -4318,7 +4318,7 @@ getPublications(Archive *fout) if (fout->remoteVersion >= 180000) appendPQExpBufferStr(query, "p.pubgencols_type "); else - appendPQExpBufferStr(query, CppAsString2(PUBLISH_GENCOLS_NONE) " AS pubgencols_type "); + appendPQExpBuffer(query, "'%c' AS pubgencols_type ", PUBLISH_GENCOLS_NONE); appendPQExpBufferStr(query, "FROM pg_publication p"); -- 2.43.0