If a FOR ALL TABLES publication exists, unlogged tables are ignored
for publishing changes. But CheckCmdReplicaIdentity() would still
check in that case that such a table has a replica identity set before
accepting updates. That is useless, so check first whether the given
table is publishable and skip the check if not.
Example:
CREATE PUBLICATION pub FOR ALL TABLES;
CREATE UNLOGGED TABLE logical_replication_test AS SELECT 1 AS number;
UPDATE logical_replication_test SET number = 2;
ERROR: cannot update table "logical_replication_test" because it does
not have a replica identity and publishes updates
Patch attached.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services