Re: Proposal: Conflict log history table for Logical Replication
shveta malik <shveta.malik@gmail.com>
From: shveta malik <shveta.malik@gmail.com>
To: vignesh C <vignesh21@gmail.com>
Cc: Dilip Kumar <dilipbalaut@gmail.com>,
Amit Kapila <amit.kapila16@gmail.com>, Masahiko Sawada <sawada.mshk@gmail.com>, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
shveta malik <shveta.malik@gmail.com>
Date: 2026-01-05T04:28:55Z
Lists: pgsql-hackers
On Fri, Jan 2, 2026 at 12:06 PM shveta malik <shveta.malik@gmail.com> wrote:
>
> On Fri, Dec 26, 2025 at 8:58 PM vignesh C <vignesh21@gmail.com> wrote:
> >
> >
> > Here is a rebased version of the remaining patches.
> >
>
> Thank You Vignesh. Please find a few comments on 004:
>
Vignesh, please find a few comments on 005.
1)
AlterSubscriptionConflictLogDestination()
+ if (want_table && !has_oldtable)
+ {
+ char relname[NAMEDATALEN];
+
+ snprintf(relname, NAMEDATALEN, "conflict_log_table_%u", sub->oid);
+
+ relid = get_relname_relid(relname, PG_CONFLICT_NAMESPACE);
+ if (OidIsValid(relid))
We have added this new scenario wherein we check if CLT is present
already and if so, just set it in subid.
a) Where will this scenario be hit? Can we please add the comments?
On trying pg_dump, I see that it does not dump CLT and thus above will
not be hit in pg_dump at least.
b) Even if we have a valid scenario where we have a pre-existing CLT
and sub is created later, how/where are we ensuring that subid in CLT
name will match newly generated subid?
2)
+ if (IsConflictLogTable(relid))
+ ereport(ERROR,
+ errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+ errmsg("conflict log table \"%s.%s\" cannot be used",
+ nspname, relname),
+ errdetail("The specified table is already registered for a different
subscription."),
+ errhint("Specify a different conflict log table."));
a) Since the user is not specifying the CLT name, errhint seems incorrect.
b) Again, I am unable to understand when this error will be hit? Since
CLT is internally created using subid of owning subscription, how CLT
of a particular subid be connected to subscription of different subid
to result in above error? Can you please add comments to explain the
situation.
thanks
Shveta
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Allow logical replication conflicts to be logged to a table.
- a5918fddf10d master landed
-
Avoid orphaned objects dependencies
- 2fbb21170e90 19 (unreleased) cited