On Fri, Feb 27, 2026 at 5:40 PM dfgpostgres <dfgpostgres3(at)gmail(dot)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!