Re: How to fully restore a single table from a custom dump?

Поиск
Список
Период
Сортировка
От Holger Jakobs
Тема Re: How to fully restore a single table from a custom dump?
Дата
Msg-id 9ca2d8ca-a175-630e-e449-48c2dee5e0f6@jakobs.com
обсуждение исходный текст
Ответ на How to fully restore a single table from a custom dump?  (Thomas Kellerer <shammat@gmx.net>)
Ответы Re: How to fully restore a single table from a custom dump?
Список pgsql-admin
Am 09.08.22 um 14:49 schrieb MichaelDBA Vitale:
Hi,
If you use the directory dump method, -Fd, then you could generate an editable listing where you can selectively remove stuff that you don't want to restore, just keeping the stuff related to your specific table.   You run pg_restore once to generate the listing.  Then run pg_restore again using that modified listing to load into the target database. See the pg_restore docs for exact syntax.
 
Regards,
Michael Vitale
 
On 08/09/2022 8:06 AM EDT Thomas Kellerer <shammat@gmx.net> wrote:
 
 
Hello,
 
I just realized that using
 
pg_restore -t some_table ... some_dump_file
 
doesn't restore things like identity attributes
or indexes on the specified table.
 
The dump contains much more than just that table, so simply
using pg_restore without -t is not an option.
 
While I could extract the indexes manually using some clever regex
on the index names, I don't see a way to make sure that identity
definitions (or sequence values) are restored properly for the selected table.
 
Any ideas, how I can _fully_ restore a single table from a custom dump?
 
Thomas

Creating a list of contained items and restoring some of them works the same with custom dumps. Directory dumps have no advantage here.

Just comment out all items you don't want to restore by putting a ; in front of the lines or delete the unwanted lines altogether and restore.

Best regards,

Holger

-- 
Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012
Вложения

В списке pgsql-admin по дате отправления:

Предыдущее
От: Thomas Kellerer
Дата:
Сообщение: How to fully restore a single table from a custom dump?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: How to fully restore a single table from a custom dump?