From e80db286366c389e944e7bb927815c9be7b651dd Mon Sep 17 00:00:00 2001
From: Tomas Vondra <tomas.vondra@postgresql.org>
Date: Wed, 15 Mar 2023 13:48:42 +0100
Subject: [PATCH 4/4] puballtables fixup

---
 src/backend/replication/pgoutput/pgoutput.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c
index 7012021b98f..1b4331e2c5a 100644
--- a/src/backend/replication/pgoutput/pgoutput.c
+++ b/src/backend/replication/pgoutput/pgoutput.c
@@ -2239,7 +2239,7 @@ get_rel_sync_entry(PGOutputData *data, Relation relation)
 			 * FOR ALL SEQUENCES publication, we publish it too but we
 			 * don't need to pick the partition root etc.
 			 */
-			if (pub->alltables || pub->allsequences)
+			if (pub->alltables && (objectType == PUB_OBJTYPE_TABLE))
 			{
 				publish = true;
 				if (pub->pubviaroot && am_partition)
@@ -2250,6 +2250,10 @@ get_rel_sync_entry(PGOutputData *data, Relation relation)
 					ancestor_level = list_length(ancestors);
 				}
 			}
+			else if (pub->allsequences && (objectType == PUB_OBJTYPE_SEQUENCE))
+			{
+				publish = true;
+			}
 
 			if (!publish)
 			{
-- 
2.39.2

