| From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
|---|---|
| To: | Andreas Karlsson <andreas(at)proxel(dot)se> |
| Cc: | surya poondla <suryapoondla4(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: [DESIGN] Soft DROP TABLE, recoverable drops for PostgreSQL |
| Date: | 2026-07-25 04:31:50 |
| Message-ID: | CAA4eK1JrsMd-1H6tZ6=j_NO=Vqoj1s=oFb46Zd2VAqCXLKo33g@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Sat, Jul 25, 2026 at 2:10 AM Andreas Karlsson <andreas(at)proxel(dot)se> wrote:
>
> On 7/2/26 2:55 AM, surya poondla wrote:
> > The patch adds contrib/pgtrashcan: a new extension that intercepts DROP
> > TABLE via a ProcessUtility hook and moves the relation to a
> > reserved schema instead of destroying it, from where it can be restored
> > with pgtrashcan_restore or permanently deleted with
> > pgtrashcan_purge. It is a fork of an existing pgtrashcan extension,
> > extended with additional features.
> >
> > Any feedback is welcome.
>
> Is there any reason your features cannot be added to the existing
> extension? Or that extension to be forked but still live outside core
> PostgresSQL?
>
The one argument I see for keeping such a feature in-tree is that it
touches a number of subsystems that evolve with core and would need
coordinated review: dependency handling and CASCADE (foreign keys,
views, etc.), pg_dump/pg_upgrade treatment of the reserved schema and
the objects parked in it, event triggers, triggers that reference
other relations, and interaction with logical/DDL replication. These
interactions are subtle and can change over time, so maintaining them
alongside core might be easier in the tree than chasing core from
outside.
On the other hand, I'm not sure if it's a good idea to protect only
DROP TABLE and not the other paths like DROP SCHEMA ... CASCADE, DROP
OWNED,
etc., as pointed out by Zsolt. I think we should first decide whether
such a feature is useful enough to add to core, and then work out the
appropriate design to accomplish it. Surya's initial email lists use
cases that sound reasonable, and several other databases do support
this, but not sure those are enough to justify making it a core
feature.
--
With Regards,
Amit Kapila.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Álvaro Herrera | 2026-07-25 07:07:26 | Re: NULL pointer dereference in syslogger with load_libraries() and -DEXEC_BACKEND at startup |
| Previous Message | Michael Paquier | 2026-07-25 03:54:03 | Re: NULL pointer dereference in syslogger with load_libraries() and -DEXEC_BACKEND at startup |