Re: Fix handling of unlogged tables in FOR ALL TABLES publications

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp
Cc: peter(dot)eisentraut(at)2ndquadrant(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Fix handling of unlogged tables in FOR ALL TABLES publications
Date: 2019-03-14 06:03:28
Message-ID: 20190314.150328.172224727.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Thu, 14 Mar 2019 11:30:12 +0900, Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> wrote in <59e5a734-9e06-1035-385b-6267175819aa(at)lab(dot)ntt(dot)co(dot)jp>
> On 2019/03/13 21:03, Peter Eisentraut wrote:
> > 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.
>
> An email on -bugs earlier this morning complains of the same problem but
> for temporary tables.
>
> https://www.postgresql.org/message-id/CAHOFxGr%3DmqPZXbAuoR7Nbq-bU4HxqVWHbTTUy5%3DPKQut_F0%3DXA%40mail.gmail.com
>
> It seems your patch fixes their case too.

Is it the right thing that GetRelationPublicationsActions sets
wrong rd_publicatons for the relations?

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
0001-step1.patch text/x-patch 1.0 KB
0002-step2-fix-indentation.patch text/x-patch 2.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2019-03-14 06:06:06 RE: Timeout parameters
Previous Message Michael Paquier 2019-03-14 05:17:39 Re: Progress reporting for pg_verify_checksums