From e587a104953b0c12166e97fe9e038a8267186223 Mon Sep 17 00:00:00 2001
From: Vignesh <vignesh21@gmail.com>
Date: Tue, 21 Jan 2025 10:44:55 +0530
Subject: [PATCH v54 1/5] Fix incorrect column index when describing
 publication in PG17

When using the psql client to describe a publication on a PG17 server,
an issue arose due to the use of an incorrect column index when fetching
results. This occurred because the newly added "Generated columns" was
placed before the existing "Via Root" column, instead of being added as
the last column. The logic for fetching results did not account for the
absence of the "Generated columns" column in PG17, leading to the "Via Root"
column referencing the wrong index.  The issue has been resolved by
selecting default values for these columns.
---
 src/bin/psql/describe.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 2ef99971ac..8c0ad8439e 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -6495,12 +6495,23 @@ describePublications(const char *pattern)
 	if (has_pubtruncate)
 		appendPQExpBufferStr(&buf,
 							 ", pubtruncate");
+	else
+		appendPQExpBufferStr(&buf,
+							 ", false AS pubtruncate");
+
 	if (has_pubgencols)
 		appendPQExpBufferStr(&buf,
 							 ", pubgencols");
+	else
+		appendPQExpBufferStr(&buf,
+							 ", false AS pubgencols");
+
 	if (has_pubviaroot)
 		appendPQExpBufferStr(&buf,
 							 ", pubviaroot");
+	else
+		appendPQExpBufferStr(&buf,
+							 ", false AS pubviaroot");
 
 	appendPQExpBufferStr(&buf,
 						 "\nFROM pg_catalog.pg_publication\n");
-- 
2.43.0

