Re: pg_dump / pgrestore question - cannot restore a single schema

Поиск
Список
Период
Сортировка
Искать
От
Holger Jakobs
Тема
Re: pg_dump / pgrestore question - cannot restore a single schema
Дата
Msg-id
1226ea80-e760-54ff-47e3-c2a0c90cf1e0@jakobs.com
Ответ на
Список
Дерево обсуждения
pg_dump / pgrestore question - cannot restore a single schema "S.Bob" <sbob@quadratum-braccas.com>
Re: pg_dump / pgrestore question - cannot restore a single schema "David G. Johnston" <david.g.johnston@gmail.com>
Re: pg_dump / pgrestore question - cannot restore a single schema Holger Jakobs <holger@jakobs.com>

You could also extract the commands for creating the schema contained in the dump using the following commands:

schemaname=whatever_your_schemaname_is
pg_restore -l /tmp/dump | grep "SCHEMA - $schemaname" > /tmp/objects_to_re-create
pg_restore -L /tmp/objects_to_re-create -f - /tmp/my_custom_dump | psql

and then

pg_restore -n "$schemaname" /tmp//tmp/my_custom_dump | psql

in order to re-create the contents of the schema.

Regards,

Holger

Am 24.03.20 um 01:40 schrieb David G. Johnston:
On Mon, Mar 23, 2020 at 4:47 PM S.Bob <sbob@quadratum-braccas.com> wrote:

However if I try to restore only one of the schemas it does not work, seems like it does not create the schema first:

Since you have to know the schema name anyway in order to restore that schema only just go ahead an create the schema before performing the restore.  It seems that since a schema is not "in itself" it doesn't get restored.  Doesn't seem like a problem.

David J.

-- 
Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012
В списке pgsql-admin по дате отправления
От: David G. Johnston
Дата:
От: Mariel Cherkassky
Дата:
FAQ