Re: Can "on delete cascade" dependency be used in pgdump or similar ?

Ron Johnson <ronljohnsonjr@gmail.com>

From: Ron Johnson <ronljohnsonjr@gmail.com>
To: pgsql-general <pgsql-general@postgresql.org>
Date: 2026-02-28T22:39:37Z
Lists: pgsql-general
On Fri, Feb 27, 2026 at 5:40 PM dfgpostgres <dfgpostgres3@gmail.com> wrote:

> pg 15.15 on linux
>
[snip]

>  Is there a better way to approach this problem of archiving one project
> (remembering that we do have the "on delete cascade" set up) ?
>

Yes.  postgres_fdw is what you want.  It will let you:
INSERT INTO archive.projects SELECT * FROM projects WHERE project='a';
INSERT INTO archive.child1 SELECT * FROM child1 WHERE project='a';
INSERT INTO archive.child2 SELECT * FROM child2 WHERE project='a';
INSERT INTO archive.grandchild1 SELECT * FROM  archive.grandchild1 WHERE ...

-- 
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!