Re: Proposal: Conflict log history table for Logical Replication

From: shveta malik <shveta(dot)malik(at)gmail(dot)com>
To: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Cc: Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, shveta malik <shveta(dot)malik(at)gmail(dot)com>
Subject: Re: Proposal: Conflict log history table for Logical Replication
Date: 2026-06-23 05:27:48
Message-ID: CAJpy0uB-7vea9KbnTuz6UeQqEeDYq_W7Lswq5bBVOe0uKt91Qg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jun 22, 2026 at 8:52 PM Dilip Kumar <dilipbalaut(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2026-06-23 05:36:32 Re: [PATCH] Warn when io_min_workers exceeds io_max_workers
Previous Message cca5507 2026-06-23 05:20:47 Re: Handle concurrent drop when doing whole database vacuum