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