pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
To: Langote_Amit_f8@lab.ntt.co.jp
Cc: pgsql-hackers@postgresql.org
Subject: Re: Fix handling of unlogged tables in FOR ALL TABLES publications
Date: Mon, 25 Mar 2019 09:04:05 +0100
Message-ID: <621516ad-7adc-9136-0a9b-21bce6e893d6@2ndquadrant.com> (raw)
In-Reply-To: <20190314.162716.103433381.horiguchi.kyotaro@lab.ntt.co.jp>
References: <59e5a734-9e06-1035-385b-6267175819aa@lab.ntt.co.jp>
	<20190314.150328.172224727.horiguchi.kyotaro@lab.ntt.co.jp>
	<26bfa053-3fb2-ad1d-efbb-7c930b41c0fd@lab.ntt.co.jp>
	<20190314.162716.103433381.horiguchi.kyotaro@lab.ntt.co.jp>

So perhaps push the check down to GetRelationPublicationActions()
instead.  That way we don't have to patch up two places and everything
"just works" even for possible other callers.  See attached patch.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachments:

v2-0001-Fix-handling-of-unlogged-tables-in-FOR-ALL-TABLES.patch (text/plain, 1.4K) download From 55255a6e338ccb11b4a7a8d6f10aff7a805cd72b Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <peter@eisentraut.org> 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

view thread (7+ messages)  latest in thread

Message-ID: <621516ad-7adc-9136-0a9b-21bce6e893d6@2ndquadrant.com>
Permalink:  ../621516ad-7adc-9136-0a9b-21bce6e893d6@2ndquadrant.com/
Also on:    postgresql.org/message-id/621516ad-7adc-9136-0a9b-21bce6e893d6@2ndquadrant.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: peter.eisentraut@2ndquadrant.com, horiguchi.kyotaro@lab.ntt.co.jp, Langote_Amit_f8@lab.ntt.co.jp
  Subject: Re: Fix handling of unlogged tables in FOR ALL TABLES publications
  In-Reply-To: <621516ad-7adc-9136-0a9b-21bce6e893d6@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox