public inbox for [email protected]  
help / color / mirror / Atom feed
From: Ron Johnson <[email protected]>
To: pgsql-general <[email protected]>
Subject: Re: Can "on delete cascade" dependency be used in pgdump or similar ?
Date: Sat, 28 Feb 2026 17:39:37 -0500
Message-ID: <CANzqJaDGNSrgbbAs7VoLHCgkFOf0c75WeyoWTsVKRrFoWC3gTw@mail.gmail.com> (raw)
In-Reply-To: <CAAcmDX_zrfbQ2ixpGH_92SqeM=OJs5wPuW2_F-P+SefjoQGUOQ@mail.gmail.com>
References: <CAAcmDX_zrfbQ2ixpGH_92SqeM=OJs5wPuW2_F-P+SefjoQGUOQ@mail.gmail.com>

On Fri, Feb 27, 2026 at 5:40 PM dfgpostgres <[email protected]> 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!


reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: Can "on delete cascade" dependency be used in pgdump or similar ?
  In-Reply-To: <CANzqJaDGNSrgbbAs7VoLHCgkFOf0c75WeyoWTsVKRrFoWC3gTw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox