Re: Proposal: Conflict log history table for Logical Replication

Amit Kapila <amit.kapila16@gmail.com>

From: Amit Kapila <amit.kapila16@gmail.com>
To: Dilip Kumar <dilipbalaut@gmail.com>
Cc: vignesh C <vignesh21@gmail.com>, shveta malik <shveta.malik@gmail.com>, Nisha Moond <nisha.moond412@gmail.com>, Peter Smith <smithpb2250@gmail.com>, Masahiko Sawada <sawada.mshk@gmail.com>, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, shveta malik <shvetamalik@gmail.com>
Date: 2026-05-29T18:47:49Z
Lists: pgsql-hackers
On Fri, May 29, 2026 at 2:23 AM Dilip Kumar <dilipbalaut@gmail.com> wrote:
>
> On Thu, May 28, 2026 at 2:57 AM Amit Kapila <amit.kapila16@gmail.com> wrote:
>
>   I think I am facing a
> > related problem w.r.t newly created subscription. After applying first
> > six patches, the create subscription fails as follows:
> > postgres=# create subscription sub1 connection 'dbname=postgres'
> > publication pub1 with (conflict_log_destination='all');
> > ERROR:  dependent subscription was concurrently dropped
> >
> > I debugged and found that we get the above ERROR when we are trying to
> > find the subscription which is not yet created. In this case, it seems
> > to be happening because we are using a subscription that is yet not
> > created for dependency recording. This raises a question as to why are
> > we creating the conflict_log_table before subscription, at least this
> > needs some comments.
>
> This error occurs because in the commit below [1], we disallowed
> recording a dependency on an object that does not exist. Therefore, we
> now need to record the dependency after the subscription is created.
>

But don't we normally create dependency immediately after creating the
object? Do you see such examples at other places in the code?

> And we create CLT before so that we can add the conflict log relid in
> pg_subscription without an additional update,
>

But will this additional update matter to an extent in DDL execution
that we don't follow our usual way to record dependency? I feel unless
we follow similar coding pattern at other places, it is better to
create the CLT after subscription.

-- 
With Regards,
Amit Kapila.