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

From David G. Johnston
Subject Re: Retrieve "CREATE FOREIGN SERVER" with pg_dump ... --schema=
Date
Msg-id CAKFQuwaJjOsJmPT0muEREEM=EOYjWVkUcN_bYjMFCid8PsRuFg@mail.gmail.com
Whole thread Raw
Responses Re: Retrieve "CREATE FOREIGN SERVER" with pg_dump ... --schema=
List pgsql-admin
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: Peter Adlersburg
Date:
Subject: Retrieve "CREATE FOREIGN SERVER" with pg_dump ... --schema=
Next
From: Peter Adlersburg
Date:
Subject: Re: Retrieve "CREATE FOREIGN SERVER" with pg_dump ... --schema=