v48_0001_amit.patch.txt

text/plain

Filename: v48_0001_amit.patch.txt
Type: text/plain
Part: 0
Message: Re: Pgoutput not capturing the generated columns
diff --git a/src/backend/replication/logical/proto.c b/src/backend/replication/logical/proto.c
index 2c8fbc593a..2c2085b2f9 100644
--- a/src/backend/replication/logical/proto.c
+++ b/src/backend/replication/logical/proto.c
@@ -1272,10 +1272,6 @@ logicalrep_should_publish_column(Form_pg_attribute att, Bitmapset *columns,
 	if (columns)
 		return bms_is_member(att->attnum, columns);
 
-	/*
-	 * If no column list is provided, generated columns will be published only
-	 * if include_gencols is true, while all non-generated columns will always
-	 * be published.
-	 */
+	/* All non-generated columns are always published. */
 	return att->attgenerated ? include_gencols : true;
 }
diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c
index 386b087f79..014454d67b 100644
--- a/src/backend/replication/pgoutput/pgoutput.c
+++ b/src/backend/replication/pgoutput/pgoutput.c
@@ -168,9 +168,8 @@ typedef struct RelationSyncEntry
 	Bitmapset  *columns;
 
 	/*
-	 * Include generated columns for publication is set to true if
-	 * 'publish_generated_columns' parameter is true, and the relation
-	 * contains generated columns.
+	 * This is set if the 'publish_generated_columns' parameter is true, and
+	 * the relation contains generated columns.
 	 */
 	bool		include_gencols;
 
@@ -1098,7 +1097,6 @@ pgoutput_column_list_init(PGOutputData *data, List *publications,
 	 * fetch_table_list. But one can later change the publication so we still
 	 * need to check all the given publication-table mappings and report an
 	 * error if any publications have a different column list.
-	 *
 	 */
 	foreach(lc, publications)
 	{
@@ -1157,11 +1155,8 @@ pgoutput_column_list_init(PGOutputData *data, List *publications,
 		if (!cols)
 		{
 			/*
-			 * For the first publication with no specified column list, we
-			 * retrieve and cache the table columns. This allows comparison
-			 * with the column lists of other publications to detect any
-			 * differences. Columns are retrieved only when there is more than
-			 * one publication, as differences can only arise in that case.
+			 * Cache the table columns for the first publication with no specified
+			 * column list to detect publication with a different column list.
 			 */
 			if (!relcols && (list_length(publications) > 1))
 			{
@@ -1187,8 +1182,8 @@ pgoutput_column_list_init(PGOutputData *data, List *publications,
 	}							/* loop all subscribed publications */
 
 	/*
-	 * If no column list publications exist, columns will be selected later
-	 * according to the 'publish_generated_columns' parameter.
+	 * If no column list publications exist, columns to be published will be
+	 * computed later according to the 'publish_generated_columns' parameter.
 	 */
 	if (!found_pub_with_collist)
 		entry->columns = NULL;