summaryrefslogtreecommitdiff
path: root/src/bin/psql/describe.c
diff options
context:
space:
mode:
authorAmit Kapila <akapila@postgresql.org>2025-01-23 15:28:37 +0530
committerAmit Kapila <akapila@postgresql.org>2025-01-23 15:28:37 +0530
commite65dbc9927fb86aa3c8a914ede6a6ae934384f5a (patch)
treebaf5c64867d7376c40135fc115860c1339087204 /src/bin/psql/describe.c
parenteef4a33f62f7300765b5ffa8c966fa2fba50d176 (diff)
Change publication's publish_generated_columns option type to enum.
The current boolean publish_generated_columns option only supports a binary choice, which is insufficient for future enhancements where generated columns can be of different types (e.g., stored or virtual). The supported values for the publish_generated_columns option are 'none' and 'stored'. Author: Vignesh C <vignesh21@gmail.com> Reviewed-by: Peter Smith <smithpb2250@gmail.com> Reviewed-by: Peter Eisentraut <peter@eisentraut.org> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Discussion: https://postgr.es/m/d718d219-dd47-4a33-bb97-56e8fc4da994@eisentraut.org Discussion: https://postgr.es/m/B80D17B2-2C8E-4C7D-87F2-E5B4BE3C069E@gmail.com
Diffstat (limited to 'src/bin/psql/describe.c')
-rw-r--r--src/bin/psql/describe.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 8c0ad8439eb..2e84b61f184 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -24,6 +24,7 @@
#include "catalog/pg_constraint_d.h"
#include "catalog/pg_default_acl_d.h"
#include "catalog/pg_proc_d.h"
+#include "catalog/pg_publication_d.h"
#include "catalog/pg_statistic_ext_d.h"
#include "catalog/pg_subscription_d.h"
#include "catalog/pg_type_d.h"
@@ -6372,7 +6373,12 @@ listPublications(const char *pattern)
gettext_noop("Truncates"));
if (pset.sversion >= 180000)
appendPQExpBuffer(&buf,
- ",\n pubgencols AS \"%s\"",
+ ",\n (CASE pubgencols_type\n"
+ " WHEN '%c' THEN 'none'\n"
+ " WHEN '%c' THEN 'stored'\n"
+ " END) AS \"%s\"",
+ PUBLISH_GENCOLS_NONE,
+ PUBLISH_GENCOLS_STORED,
gettext_noop("Generated columns"));
if (pset.sversion >= 130000)
appendPQExpBuffer(&buf,
@@ -6500,11 +6506,17 @@ describePublications(const char *pattern)
", false AS pubtruncate");
if (has_pubgencols)
- appendPQExpBufferStr(&buf,
- ", pubgencols");
+ appendPQExpBuffer(&buf,
+ ", (CASE pubgencols_type\n"
+ " WHEN '%c' THEN 'none'\n"
+ " WHEN '%c' THEN 'stored'\n"
+ " END) AS \"%s\"\n",
+ PUBLISH_GENCOLS_NONE,
+ PUBLISH_GENCOLS_STORED,
+ gettext_noop("Generated columns"));
else
appendPQExpBufferStr(&buf,
- ", false AS pubgencols");
+ ", 'none' AS pubgencols");
if (has_pubviaroot)
appendPQExpBufferStr(&buf,