PS_0003_DIFF.txt

text/plain

Filename: PS_0003_DIFF.txt
Type: text/plain
Part: 0
Message: Re: Pgoutput not capturing the generated columns
diff --git a/doc/src/sgml/ref/create_publication.sgml b/doc/src/sgml/ref/create_publication.sgml
index a4be921..e822ea2 100644
--- a/doc/src/sgml/ref/create_publication.sgml
+++ b/doc/src/sgml/ref/create_publication.sgml
@@ -196,6 +196,9 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
           Specifies whether the generated columns present in the tables
           associated with the publication should be replicated. Possible values
           are <literal>none</literal> and <literal>stored</literal>.
+         </para>
+
+         <para>
           The default is <literal>none</literal> meaning the generated
           columns present in the tables associated with publication will not be
           replicated.
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index c28fde7..9d47dc8 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -6374,9 +6374,11 @@ listPublications(const char *pattern)
 	if (pset.sversion >= 180000)
 		appendPQExpBuffer(&buf,
 							",\n (CASE pubgencols_type\n"
-							"    WHEN " CppAsString2(PUBLISH_GENCOLS_NONE) " THEN 'none'\n"
-							"    WHEN " CppAsString2(PUBLISH_GENCOLS_STORED) " THEN 'stored'\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,
@@ -6526,9 +6528,11 @@ describePublications(const char *pattern)
 	{
 		appendPQExpBuffer(&buf,
 						  ", (CASE pubgencols_type\n"
-						  "    WHEN " CppAsString2(PUBLISH_GENCOLS_NONE) " THEN 'none'\n"
-						  "    WHEN " CppAsString2(PUBLISH_GENCOLS_STORED) " THEN 'stored'\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"));
 		pubgen_col = ncols++;
 	}
diff --git a/src/include/catalog/pg_publication.h b/src/include/catalog/pg_publication.h
index 5b1715b..6e81f8c 100644
--- a/src/include/catalog/pg_publication.h
+++ b/src/include/catalog/pg_publication.h
@@ -110,13 +110,27 @@ typedef struct PublicationDesc
 	bool		gencols_valid_for_delete;
 } PublicationDesc;
 
+#ifdef EXPOSE_TO_CLIENT_CODE
+
+typedef enum PublishGencolsType
+{
+  /* Generated columns present should not be replicated. */
+  PUBLISH_GENCOLS_NONE = 'n',
+
+  /* Generated columns present should be replicated. */
+  PUBLISH_GENCOLS_STORED = 's',
+
+} PublishGencolsType;
+
+#endif  /* EXPOSE_TO_CLIENT_CODE */
+
 typedef struct Publication
 {
 	Oid			oid;
 	char	   *name;
 	bool		alltables;
 	bool		pubviaroot;
-	char		pubgencols_type;
+	PublishGencolsType		pubgencols_type;
 	PublicationActions pubactions;
 } Publication;
 
@@ -127,16 +141,6 @@ typedef struct PublicationRelInfo
 	List	   *columns;
 } PublicationRelInfo;
 
-#ifdef EXPOSE_TO_CLIENT_CODE
-
-/* Generated columns present should not be replicated. */
-#define PUBLISH_GENCOLS_NONE 'n'
-
-/* Generated columns present should be replicated. */
-#define PUBLISH_GENCOLS_STORED 's'
-
-#endif							/* EXPOSE_TO_CLIENT_CODE */
-
 extern Publication *GetPublication(Oid pubid);
 extern Publication *GetPublicationByName(const char *pubname, bool missing_ok);
 extern List *GetRelationPublications(Oid relid);