Thread
-
Re: Proposal: Conflict log history table for Logical Replication
Dilip Kumar <dilipbalaut@gmail.com> — 2025-12-22T15:41:03Z
On Mon, Dec 22, 2025 at 3:09 PM shveta malik <shveta.malik@gmail.com> wrote: I think this needs more thought, others can be fixed. > 2) > postgres=# drop schema shveta cascade; > NOTICE: drop cascades to subscription sub1 > ERROR: global objects cannot be deleted by doDeletion > > Is this expected? Is the user supposed to see this error? > See below code, so this says if the object being dropped is the outermost object (i.e. if we are dropping the table directly) then it will disallow dropping the object on which it has INTERNAL DEPENDENCY, OTOH if the object is being dropped via recursive drop (i.e. the table is being dropped while dropping the schema) then object on which it has INTERNAL dependency will also be added to the deletion list and later will be dropped via doDeletion and later we are getting error as subscription is a global object. I thought maybe we can handle an additional case that the INTERNAL DEPENDENCY, is on subscription the disallow dropping it irrespective of whether it is being called directly or via recursive drop but then it will give an issue even when we are trying to drop table during subscription drop, we can make handle this case as well via 'flags' passed in findDependentObjects() but need more investigation. Seeing this complexity makes me think more on is it really worth it to maintain this dependency? Because during subscription drop we anyway have to call performDeletion externally because this dependency is local so we are just disallowing the conflict table drop, however the ALTER table is allowed so what we are really protecting by protecting the table drop, I think it can be just documented that if user try to drop the table then conflict will not be inserted anymore? findDependentObjects() { ... switch (foundDep->deptype) { .... case DEPENDENCY_INTERNAL: * 1. At the outermost recursion level, we must disallow the * DROP. However, if the owning object is listed in * pendingObjects, just release the caller's lock and return; * we'll eventually complete the DROP when we reach that entry * in the pending list. } } [1] postgres[1333899]=# select * from pg_depend where objid > 16410; classid | objid | objsubid | refclassid | refobjid | refobjsubid | deptype ---------+-------+----------+------------+----------+-------------+--------- 1259 | 16420 | 0 | 2615 | 16410 | 0 | n 1259 | 16420 | 0 | 6100 | 16419 | 0 | i (4 rows) 16420 -> conflict_log_table_16419 16419 -> subscription 16410 -> schema s1 -- Regards, Dilip Kumar Google