Thread
-
Re: Proposal: Conflict log history table for Logical Replication
Dilip Kumar <dilipbalaut@gmail.com> — 2025-12-12T04:11:58Z
On Fri, Dec 12, 2025 at 9:19 AM shveta malik <shveta.malik@gmail.com> wrote: > > On Thu, Dec 11, 2025 at 7:49 PM Dilip Kumar <dilipbalaut@gmail.com> wrote: > > > > We do not need to make the CLT dependent on the subscription because > > the table can be dropped when the subscription is dropped anyway and > > we are already doing it as part of drop subscription as well as alter > > subscription when CLT is set to NONE or a different table. Therefore, > > extending the functionality of shared dependency is unnecessary for > > this purpose. > > > > Thoughts? > > I believe the recommendation to create a dependency was meant to > prevent the table from being accidentally dropped during a DROP SCHEMA > or DROP TABLE operation. That risk still remains, regardless of the > fact that dropping or altering a subscription will result in the table > removal. I will give this more thought and let you know if anything > comes to mind. I mean we can register the dependency of subscriber on table and that will prevent dropping the tables via DROP TABLE/DROP SCHEMA, but what I do not like is the internal error[1] in doDeletion() when someone will try to DROP TABLE CLT CASCADE; I suggest an alternative approach for handling this: implement a check within the ALTER/DROP table commands. If the table is a CLT (using IsConflictLogTable() to verify), these operations should be disallowed. This would enhance the robustness of CLT handling by entirely preventing external drop/alter actions. What are your thoughts on this solution? And let's also see what Amit and Sawada-san think about this solution. [1] doDeletion() { .... /* * These global object types are not supported here. */ case AuthIdRelationId: case DatabaseRelationId: case TableSpaceRelationId: case SubscriptionRelationId: case ParameterAclRelationId: elog(ERROR, "global objects cannot be deleted by doDeletion"); break; } -- Regards, Dilip Kumar Google