Re: Warn on missing replica identity in CREATE/ALTER PUBLICATION

From: shveta malik <shveta(dot)malik(at)gmail(dot)com>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: 南拓弥 <minamitakuya(at)lifull(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, shveta malik <shveta(dot)malik(at)gmail(dot)com>
Subject: Re: Warn on missing replica identity in CREATE/ALTER PUBLICATION
Date: 2026-04-23 07:07:41
Message-ID: CAJpy0uBWUR+nBfqHaDOwPAZvg7xT-9yEiYSwJVtp=vwVGJq_wA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Apr 23, 2026 at 12:21 PM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
>
>
>
> > On Apr 23, 2026, at 13:46, 南拓弥 <minamitakuya(at)lifull(dot)com> wrote:
> >
> > # Reply draft v2 to Shveta
> >
> > ---
> >
> > Hi Shveta,
> >
> > Thanks for pointing out that thread. I've read through it carefully.
> >
> > I believe the two proposals address different aspects of the same
> > problem:
> >
> > - The fallback RI approach changes runtime behavior so that tables
> > without a primary key can still replicate UPDATE/DELETE.
> > - This proposal simply warns at DDL time that a publication contains
> > tables whose replica identity will cause UPDATE/DELETE to fail at
> > replication time.
> >
> > A WARNING at publication creation time is useful regardless of whether
> > a fallback mechanism exists, because:
> >
> > - If a table has REPLICA IDENTITY DEFAULT with no primary key, it
> > silently falls back to NOTHING. Combining that with a publication
> > that publishes updates/deletes is guaranteed to fail at runtime.
> > A WARNING at DDL time closes this gap.
> > - Even users who explicitly set REPLICA IDENTITY NOTHING and add the
> > table to an update/delete publication would benefit from a reminder,
> > since that combination cannot succeed.
> > - The WARNING does not change any existing behavior — it only makes
> > the misconfiguration visible earlier.
> >
> > Notably, Euler mentioned in that thread [1] that he would "suggest a
> > way to disallow or add a warning message while creating the
> > publication or adding new tables", which is exactly what this proposal
> > does.
> >
> > That said, I see the two proposals as complementary. Should I continue
> > this as a separate thread, or would it be better to join the existing
> > discussion?
> >
> > I have a working patch covering all publication paths (FOR TABLE,
> > FOR TABLES IN SCHEMA, FOR ALL TABLES, ALTER PUBLICATION). Happy to
> > post it either way.
> >
> > [1] https://www.postgresql.org/message-id/a9da608f-24be-4213-a712-8592852d37f1%40app.fastmail.com
> >
>
> You are very welcome to join the thread, as the initiator of that thread.
>
> I am not personally against your idea of adding such a warning message, but I think it would be better to consider the two features together as a whole solution from a system perspective.
>
> In any case, new features will have to wait for v20 until July, so we still have time for more discussion and deeper consideration.

I agree. But if the RI fallback option gets delayed due to lack of
consensus on the design or other reasons, issuing a WARNING during
publication creation seems like a reasonable approach.

thanks
Shveta

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-04-23 07:22:15 Re: CheckAttributeType() forgot to recurse into multiranges
Previous Message Zach Manifold 2026-04-23 06:59:19 Proposal: DROP ROLE ... REASSIGN OWNED TO ...