Re: Retrieve "CREATE FOREIGN SERVER" with pg_dump ... --schema=

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Peter Adlersburg <peter(dot)adlersburg(at)gmail(dot)com>
Cc: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: Retrieve "CREATE FOREIGN SERVER" with pg_dump ... --schema=
Date: 2024-07-08 16:32:26
Message-ID: CAKFQuwaJjOsJmPT0muEREEM=EOYjWVkUcN_bYjMFCid8PsRuFg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Mon, Jul 8, 2024 at 9:17 AM Peter Adlersburg <peter(dot)adlersburg(at)gmail(dot)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.

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Peter Adlersburg 2024-07-08 16:40:41 Re: Retrieve "CREATE FOREIGN SERVER" with pg_dump ... --schema=
Previous Message Peter Adlersburg 2024-07-08 16:16:41 Retrieve "CREATE FOREIGN SERVER" with pg_dump ... --schema=