Re: Proposal: Conflict log history table for Logical Replication - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: Proposal: Conflict log history table for Logical Replication
Date
Msg-id CAA4eK1JWYeU1iiPgbU_yM5Hoahet3En3sfdpmJn2F37RyMZahg@mail.gmail.com
Whole thread
In response to Re: Proposal: Conflict log history table for Logical Replication  (Dilip Kumar <dilipbalaut@gmail.com>)
Responses Re: Proposal: Conflict log history table for Logical Replication
List pgsql-hackers
On Tue, May 5, 2026 at 6:25 PM Dilip Kumar <dilipbalaut@gmail.com> wrote:
>
> On Tue, May 5, 2026 at 9:37 AM shveta malik <shveta.malik@gmail.com> wrote:
> >
> > On Tue, May 5, 2026 at 8:26 AM Amit Kapila <amit.kapila16@gmail.com> wrote:
> > >
> > > On Mon, May 4, 2026 at 6:41 PM Dilip Kumar <dilipbalaut@gmail.com> wrote:
> > > >
> > > > PFA, poc patch for the same.
> >
> > I like the idea of PoC. It simplifies the implementation.
> >
> > > >
> > >
> > > I know it is POC but I think you need more work to prevent manual
> > > inserts/updates on conflict tables.
> > >
> >
> > I think CheckValidResultRel() handles it.
> >
> > postgres=# insert into pg_conflict.pg_conflict_16391 values (0);
> > ERROR:  cannot modify or insert data into conflict log table "pg_conflict_16391"
> > DETAIL:  Conflict log tables are system-managed and only support
> > cleanup via DELETE or TRUNCATE
>
> I think we can tweak a bit and pg_class_aclmask_ext() we can only
> allow truncate/delete on pg_conflict and block insert and update, here
> is the modified version.  Please let me know your thoughts.
>

BTW, I am still getting the same ERROR even after POC. See
postgres=# insert into pg_conflict.pg_conflict_log_16402 values(NULL);
ERROR:  cannot modify or insert data into conflict log table
"pg_conflict_log_16402"
DETAIL:  Conflict log tables are system-managed and only support
cleanup via DELETE or TRUNCATE.

Few other comments:
*
postgres=# create subscription sub1 connection 'dbname=postgres'
publication pub1 WITH (conflict_log_destination='table');
NOTICE:  created conflict log table
pg_conflict."pg_conflict_log_16394" for subscription "sub1"
NOTICE:  created replication slot "sub1" on publisher
CREATE SUBSCRIPTION

To make the messages similar, isn't it better to use the following
wording in the first message: "created conflict log table
"pg_conflict.pg_conflict_log_16394" on subscriber? The part
"subscription "sub1"" is clear from the command itself.

*
postgres=# drop subscription sub1;
NOTICE:  dropped replication slot "sub1" on publisher
DROP SUBSCRIPTION

Drop seems to have missed the NOTICE to implicitly drop the table.

--
With Regards,
Amit Kapila.



pgsql-hackers by date:

Previous
From: Chengpeng Yan
Date:
Subject: Re: [PATCH] ANALYZE: hash-accelerate MCV tracking for equality-only types
Next
From: Ajin Cherian
Date:
Subject: Re: [PATCH] Preserve replication origin OIDs in pg_upgrade