Re: Warn on missing replica identity in CREATE/ALTER PUBLICATION - Mailing list pgsql-hackers

From Chao Li
Subject Re: Warn on missing replica identity in CREATE/ALTER PUBLICATION
Date
Msg-id 35B6A159-C2EF-4346-9394-7CB3E168B1A5@gmail.com
Whole thread
In response to Re: Warn on missing replica identity in CREATE/ALTER PUBLICATION  (南拓弥 <minamitakuya@lifull.com>)
Responses Re: Warn on missing replica identity in CREATE/ALTER PUBLICATION
List pgsql-hackers

> On Apr 23, 2026, at 13:46, 南拓弥 <minamitakuya@lifull.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
twofeatures 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.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/







pgsql-hackers by date:

Previous
From: Ashutosh Bapat
Date:
Subject: Re: [Patch]Add Graph* node support to expression_tree_mutator
Next
From: SATYANARAYANA NARLAPURAM
Date:
Subject: [Patch] Block ALTER TABLE RENAME COLUMN when column is used by property graph