From 4f7e14e9e8b48a807588e70e942c3d9c2191d386 Mon Sep 17 00:00:00 2001
From: Vignesh <vignesh21@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

