| From: | Dilip Kumar <dilipbalaut(at)gmail(dot)com> |
|---|---|
| To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
| Cc: | Peter Smith <smithpb2250(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, shveta malik <shveta(dot)malik(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> |
| Subject: | Re: Proposal: Conflict log history table for Logical Replication |
| Date: | 2026-06-30 11:50:10 |
| Message-ID: | CAFiTN-u2ZSuDdLNUCFCnt5VL3nqp2vs9GdJUN-DfdftsLgijGw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Jun 30, 2026 at 2:30 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Tue, Jun 30, 2026 at 11:02 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> >
> > On Tue, Jun 30, 2026 at 9:22 AM Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
> > >
> > > > ======
> > > > src/backend/commands/tablecmds.c
> > > >
> > > > 2.
> > > > + /*
> > > > + * Conflict log tables are managed by the system for logical
> > > > + * replication and should not be used as parent tables, as
> > > > + * inheritance could interfere with the logging behavior.
> > > > + */
> > > > + if (IsConflictLogTableNamespace(relation->rd_rel->relnamespace))
> > > > + ereport(ERROR,
> > > > + (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
> > > > + errmsg("permission denied: cannot inherit from conflict log table \"%s\"",
> > > > + RelationGetRelationName(relation)),
> > > > + errdetail("Conflict log tables are system-managed tables for logical
> > > > replication conflicts.")));
> > > >
> > > > It is not really a lack of "privilege" preventing this -- it is just
> > > > disallowed for everybody. Would ERRCODE_WRONG_OBJECT_TYPE be a more
> > > > appropriate errcode?
> > >
> > > I agree that we currently restrict most operations on CLTs, but the
> > > issue isn't that the CLT is the wrong object type, they are still
> > > relations. While we might open up certain operations in the future
> > > based on business needs (such as allowing index creation), I still
> > > believe this is a matter of privileges rather than object type.
> > >
> >
> > If we look from this POV where we want to support some features in
> > future, ERRCODE_FEATURE_NOT_SUPPORTED sounds like a better option.
> > OTOH, in execMain.c, in 0001, WRONG_OBJECT_TYPE is any way a better
> > fit because we never want to allow INSERT/UPDATE/MERGE. Having, single
> > error_code makes it easy to understand/explain/extend this feature,
> > otherwise, the future users will always be confused as to which
> > error_code is better fit. I think insuffcient_privilige doesn't suit
> > even if we want to support such features in future because those won't
> > require a new grant kind of privilege. Even though WRONG_OBJECT_TYPE
> > is slightly over stretched for some cases but I think consistency
> > helps, so, I would prefer WRONG_OBJECT_TYPE in the case Peter pointed
> > out and other DDL operations where we have a similar check.
> >
>
> I have changed the error code to WRONG_OBJECT_TYPE in the attached
> v59_amit_2.txt. The other thing that bothers me about this patch is
> the usage of DO blocks in the tests to hide the CLT name (as the same
> has OID in its name which is non-deterministic) which doesn't seem to
> be the best way as that bloats the test code and make the test cases
> difficult to read. I have changed those specific tests in the attached
> v59_amit_3.txt by using \gset and \set VERBOSITY sqlstate which we
> also use in arrays.sql and a few other places. Let me know what you
> think of attached top-up patches. Also, now let's merge your 0001 and
> 0002 patches.
I have merged these patches and also merged 0001 and 0002. Also fixed
other open comments from Nisha, Shlok, and Peter
--
Regards,
Dilip Kumar
Google
| Attachment | Content-Type | Size |
|---|---|---|
| v60-0003-Preserve-conflict-log-destination-and-subscripti.patch | application/octet-stream | 23.4 KB |
| v60-0005-Documentation-patch.patch | application/octet-stream | 42.3 KB |
| v60-0004-Add-conflict-log-table-information-to-describe-s.patch | application/octet-stream | 78.7 KB |
| v60-0002-Implement-the-conflict-insertion-infrastructure-.patch | application/octet-stream | 56.3 KB |
| v60-0001-Add-configurable-conflict-log-table-for-Logical-.patch | application/octet-stream | 82.3 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Daniil Davydov | 2026-06-30 12:01:20 | Re: Fix bug with accessing to temporary tables of other sessions |
| Previous Message | Alexander Korotkov | 2026-06-30 11:46:45 | Re: Fix bug with accessing to temporary tables of other sessions |