Re: Proposal: Conflict log history table for Logical Replication
shveta malik <shveta.malik@gmail.com>
From: shveta malik <shveta.malik@gmail.com>
To: Dilip Kumar <dilipbalaut@gmail.com>
Cc: Nisha Moond <nisha.moond412@gmail.com>,
Amit Kapila <amit.kapila16@gmail.com>, vignesh C <vignesh21@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 <shveta.malik@gmail.com>
Date: 2026-06-23T05:27:48Z
Lists: pgsql-hackers
On Mon, Jun 22, 2026 at 8:52 PM Dilip Kumar <dilipbalaut@gmail.com> wrote:
>
> >
> I have merged Amit's patch and Nisha's tap test patch and tested all
> the cases discussed, and those are working fine.
>
Thanks Dilip, few initial comments on 001+002:
1)
+ if (IsConflictLogTableNamespace(relnamespace))
+ ereport(ERROR,
+ (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+ errmsg("permission denied to create \"%s\"",
+ get_qualified_objname(relnamespace, relname)),
+ errdetail("Conflict schema modifications are
currently disallowed.")));
Unable to reproduce the error. Perhaps this change is not needed after
the change made in pg_namespace_aclmask_ext() in 002? create table,
create view inside pg_conflict errors out in
RangeVarGetAndCheckCreationNamespace itself doing schema-permission
check.
2)
Same with this:
+
+ /* similarly for conflict schema */
+ if (nspOid == PG_CONFLICT_NAMESPACE || oldNspOid == PG_CONFLICT_NAMESPACE)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot move objects into or out of the conflict schema")));
I get these errors:
postgres=# alter table tab2 set schema conf;
ERROR: 42501: permission denied for schema conf
LOCATION: aclcheck_error, aclchk.c:2813
3)
create_conflict_log_table()
+
+ /*
+ * Check for an existing table with the same name in the
pg_conflict namespace.
+ * A collision should not occur under normal operation, but we
must handle cases
+ * where a table has been created manually when allow_system_tables_mods is
+ * ON.
+ */
+ if (OidIsValid(get_relname_relid(relname, PG_CONFLICT_NAMESPACE)))
+ ereport(ERROR,
+ (errcode(ERRCODE_DUPLICATE_TABLE),
+ errmsg("conflict log table pg_conflict.\"%s\"
already exists", relname),
+ errhint("To proceed, drop the existing table and retry.")));
Should we replace this with 'Assert' since we can no longer create
tables inside the 'pg_conflict' schema, even with
'allow_system_table_mods=ON'?
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