Hi, Attached is an AI assisted patch to fix the issue Peter reported.
Since v18, tablesync no longer excludes generated columns in its pg_attribute query, and instead relies on the column list from pg_get_publication_tables() to skip unpublished columns. When none of a table's columns are published, that function returns attrs = NULL, which the subscriber reads as "no column list, so replicate all columns". So the unpublished generated columns are replicated anyway. 0002 fixes this by also fetching "gpt.attrs IS NULL" from the publisher and, for v18+ publishers, treating it as "no columns published". That leaves the table with zero replicated columns, so the fix depends on the fix for the zero-column table bug being discussed in [1]. Without it, the subscriber's COPY treats the empty column list as "all local columns": the initial sync then loads '' instead of the local default in text mode, or fails with "row field count is 0" in binary mode. To make the tests pass, I've included the v1 patch from [1], unchanged, as 0001. 0002 adds tests to 011_generated.pl for a table whose only column is VIRTUAL, and one whose only column is STORED with publish_generated_columns = none, in both text and binary mode. [1] https://www.postgresql.org/message-id/CAL5_ZS1bnYkK_GrA4N4SVKYgYsMMJxL9416m%3DvECAjrcwmQkkg%40mail.gmail.com Regards, Ajin Cherian Fujitsu Australia
v1-0001-Fix-initial-sync-of-zero-column-published-tables.patch
Description: Binary data
v1-0002-Fix-tablesync-of-tables-with-no-published-columns.patch
Description: Binary data
