Re: Retrieve "CREATE FOREIGN SERVER" with pg_dump ... --schema= - Mailing list pgsql-admin

From Peter Adlersburg
Subject Re: Retrieve "CREATE FOREIGN SERVER" with pg_dump ... --schema=
Date
Msg-id CAD1Uk1qt_HbADFdwY0ygW9rNFnFFr03h3kZ1u8CTHrCqQNrUOQ@mail.gmail.com
Whole thread Raw
In response to Re: Retrieve "CREATE FOREIGN SERVER" with pg_dump ... --schema=  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-admin
Hello David, 

I asked for a trick and I got one - will use --exclude-schemas=* accordingly. 

And yes: I could have come to this conclusion by myself ... It's been a long day ... 

Thx a million & KR 

p. 

Am Mo., 8. Juli 2024 um 18:33 Uhr schrieb David G. Johnston <david.g.johnston@gmail.com>:
On Mon, Jul 8, 2024 at 9:17 AM Peter Adlersburg <peter.adlersburg@gmail.com> wrote:

 What's the trick to use --schema= with pg_dump *AND* also have the foreign server definition and the user mappings copied?
 (I also included --schema=public but that changed nothing)
 

Create Server makes it clear it does not exist within a schema.

pg_dump has a note:

"Non-schema objects such as large objects are not dumped when -n is specified. You can add large objects back to the dump with the --large-objects switch."

The absence of any corresponding --server option in pg_dump to accomplish the same for the server non-schema object means that what you want to do is not presently possible.

Since you are doing partial dumps anyway - dump the non-schema objects first (-N *) ? then dump the desired schemas?  Then just perform two restores.

David J.

pgsql-admin by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Retrieve "CREATE FOREIGN SERVER" with pg_dump ... --schema=
Next
From: Lucio Chiessi
Date:
Subject: Logical Replication disconnecting and taking a while to return back.