From 55255a6e338ccb11b4a7a8d6f10aff7a805cd72b Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 25 Mar 2019 09:00:14 +0100 Subject: [PATCH v2] Fix handling of unlogged tables in FOR ALL TABLES publications 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. To fix, have GetRelationPublicationActions() return that such a table publishes no actions. Discussion: https://www.postgresql.org/message-id/f3f151f7-c4dd-1646-b998-f60bd6217dd3@2ndquadrant.com --- src/backend/utils/cache/relcache.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 84609e0725..e13719ee97 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -5133,6 +5133,13 @@ GetRelationPublicationActions(Relation relation) MemoryContext oldcxt; PublicationActions *pubactions = palloc0(sizeof(PublicationActions)); + /* + * If not publishable, it publishes no actions. (pgoutput_change() will + * ignore it.) + */ + if (!is_publishable_relation(relation)) + return pubactions; + if (relation->rd_pubactions) return memcpy(pubactions, relation->rd_pubactions, sizeof(PublicationActions)); -- 2.21.0