Re: Restoring only a subset of schemas - Mailing list pgsql-general

From Tom Lane
Subject Re: Restoring only a subset of schemas
Date
Msg-id 4009720.1742225376@sss.pgh.pa.us
Whole thread Raw
In response to Restoring only a subset of schemas  (Sylvain Cuaz <sylvain@ilm-informatique.fr>)
Responses Re: Restoring only a subset of schemas
List pgsql-general
Sylvain Cuaz <sylvain@ilm-informatique.fr> writes:
>      Now if I want to restore from a full dump of this DB, but with only one "cXXX" and the "Common"
> schema :
> - if I pass --create --schema=Common, then the CREATE SCHEMA is missing, i.e. it only emits data
> inside "Common" and the restore fails.
> - if I could pass --create --exclude-schema='c*' (fictional notation as patterns are only recognized
> by pg_dump), then all schemas would be created, with no data inside except for "Common". Creating
> all schemas is a waste of time, but more importantly would make restoring other schemas more
> difficult (e.g. rows should be inserted before creating foreign keys).

In general, the solution for edge-case restore selection needs is to
make a list of the dump's contents with "pg_restore -l", edit out what
you don't want using any method you like, then use the edited list with
"pg_restore -L".

While I'd be in favor of improving pg_restore to accept wild-card
patterns, I'm very hesitant to start inventing new kinds of selection
switches for it.  The interactions between such switches would be a
mess.

            regards, tom lane



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Restoring only a subset of schemas
Next
From: Ron Johnson
Date:
Subject: Re: Creating a new database on a different file system