PS_NITPICKS_20240715_GENCOLS_V170003.txt

text/plain

Filename: PS_NITPICKS_20240715_GENCOLS_V170003.txt
Type: text/plain
Part: 0
Message: Re: Pgoutput not capturing the generated columns
diff --git a/src/backend/replication/logical/tablesync.c b/src/backend/replication/logical/tablesync.c
index c2a7d18..5288769 100644
--- a/src/backend/replication/logical/tablesync.c
+++ b/src/backend/replication/logical/tablesync.c
@@ -1008,7 +1008,7 @@ fetch_remote_table_info(char *nspname, char *relname, bool **remotegenlist_res,
 					 "  LEFT JOIN pg_catalog.pg_index i"
 					 "       ON (i.indexrelid = pg_get_replica_identity_index(%u))"
 					 " WHERE a.attnum > 0::pg_catalog.int2"
-					 " AND NOT a.attisdropped", lrel->remoteid);
+					 "   AND NOT a.attisdropped", lrel->remoteid);
 
 	if(server_version >= 120000)
 	{
diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c
index 944554d..a256ab7 100644
--- a/src/backend/replication/pgoutput/pgoutput.c
+++ b/src/backend/replication/pgoutput/pgoutput.c
@@ -786,8 +786,14 @@ send_relation_and_attrs(Relation relation, TransactionId xid,
 		if (att->attisdropped)
 			continue;
 
-		if (att->attgenerated && (att->attgenerated != ATTRIBUTE_GENERATED_STORED || !include_generated_columns))
-			continue;
+		if (att->attgenerated)
+		{
+			if (!include_generated_columns)
+				continue;
+
+			if (att->attgenerated != ATTRIBUTE_GENERATED_STORED)
+				continue;
+		}
 
 		if (att->atttypid < FirstGenbkiObjectId)
 			continue;