Re: Proposal: Conflict log history table for Logical Replication

Dilip Kumar <dilipbalaut@gmail.com>

From: Dilip Kumar <dilipbalaut@gmail.com>
To: shveta malik <shveta.malik@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>, Peter Smith <smithpb2250@gmail.com>, vignesh C <vignesh21@gmail.com>, Nisha Moond <nisha.moond412@gmail.com>, Masahiko Sawada <sawada.mshk@gmail.com>, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-07-01T07:14:53Z
Lists: pgsql-hackers

Attachments

On Wed, Jul 1, 2026 at 12:04 PM shveta malik <shveta.malik@gmail.com> wrote:
>
> On Tue, Jun 30, 2026 at 5:20 PM Dilip Kumar <dilipbalaut@gmail.com> wrote:
> >
> >
> > I have merged these patches and also merged 0001 and 0002.  Also fixed
> > other open comments from Nisha, Shlok, and Peter
> >
>
> These are not needed:
>
> +++ b/src/include/replication/conflict.h
> +#include "catalog/pg_type.h"
>
> +++ b/src/backend/commands/lockcmds.c
> +#include "catalog/catalog.h"
>
> Plus we can have relevant docs added to this patch.
>
> I do not have any further comments on 001.

Thanks I have fixed these comments and also merged the docs.  Apart
from those updates, I also missed the changes related to
pg_namespace_aclmask_ext [1], so I am adding them now. While Peter
suggested [2], that approach won't fix the revoke USAGE issue raised
by Nisha. We cannot simply return early here under the assumption that
ACL_USAGE is always allowed and ACL_CREATE is never allowed. Instead,
we need to mask ACL_CREATE and let the execution flow pass through for
other ACLs. This ensures that if ACL_USAGE has been explicitly
revoked, that revocation is correctly evaluated and respected.

[1]
--- a/src/backend/catalog/aclchk.c
+++ b/src/backend/catalog/aclchk.c
@@ -3678,9 +3678,9 @@ pg_namespace_aclmask_ext(Oid nsp_oid, Oid roleid,
         * Disallow creation in the conflict schema for everyone, including
         * superusers, unless in binary-upgrade mode.
         */
-       if (!IsBinaryUpgrade && (mask & ACL_CREATE) &&
-               IsConflictLogTableNamespace(nsp_oid))
-               return mask & ~ACL_CREATE;
+       if (!IsBinaryUpgrade && (mask & ACL_CREATE) &&
+        IsConflictLogTableNamespace(nsp_oid))
+        mask &= ~ACL_CREATE;

[2]
 return mask & ACL_ALL_RIGHTS_SCHEMA & ~ACL_CREATE;

-- 
Regards,
Dilip Kumar
Google

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Allow logical replication conflicts to be logged to a table.

  2. Avoid orphaned objects dependencies