From bb385c4fb0f4eb33d2bc7e484061565ba51cc790 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 16 Apr 2019 10:37:44 +0200 Subject: Fix handling of temp and unlogged tables in FOR ALL TABLES publications If a FOR ALL TABLES publication exists, temporary and 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(+) (limited to 'src/backend/utils/cache/relcache.c') diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 4b884d55278..bab59f16e68 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -5156,6 +5156,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)); -- cgit v1.2.3