diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c
index 04684912de..09f246fc1f 100644
--- a/src/backend/replication/logical/worker.c
+++ b/src/backend/replication/logical/worker.c
@@ -949,6 +949,9 @@ apply_handle_stream_commit(StringInfo s)
 	MemoryContext oldcxt;
 	BufFile    *fd;
 
+	/* We don't allow streaming in tablesync */
+	Assert(!am_tablesync_worker());
+
 	Assert(!in_streamed_transaction);
 
 	xid = logicalrep_read_stream_commit(s, &commit_data);
