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

From: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Can "on delete cascade" dependency be used in pgdump or similar ?
Date: 2026-02-28 22:39:37
Message-ID: CANzqJaDGNSrgbbAs7VoLHCgkFOf0c75WeyoWTsVKRrFoWC3gTw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

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!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Igor Korot 2026-03-01 00:37:34 Re: Where the info is stored
Previous Message Peter J. Holzer 2026-02-28 12:00:54 Re: Timezone handling with timestamp without time zone columns