| From: | Dilip Kumar <dilipbalaut(at)gmail(dot)com> |
|---|---|
| To: | shveta malik <shveta(dot)malik(at)gmail(dot)com> |
| Cc: | vignesh C <vignesh21(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(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: | 2025-12-22 15:41:03 |
| Message-ID: | CAFiTN-uikggCKp2LscTorKY5d3KF9j93DW0xebDcRX86G+ZsSw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Mon, Dec 22, 2025 at 3:09 PM shveta malik <shveta(dot)malik(at)gmail(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Heikki Linnakangas | 2025-12-22 16:24:53 | Re: Improve the performance of Unicode Normalization Forms. |
| Previous Message | VASUKI M | 2025-12-22 15:40:50 | Re: [PATCH] psql: tab completion for ALTER ROLE ... IN DATABASE ... |