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

From: Thomas Kellerer <shammat(at)gmx(dot)net>
To: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: How to fully restore a single table from a custom dump?
Date: 2022-08-09 12:06:03
Message-ID: e434fe3f-0159-2223-8670-411d5c21c5bd@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message MichaelDBA Vitale 2022-08-09 12:49:07 Re: How to fully restore a single table from a custom dump?
Previous Message manoj kathar 2022-08-08 19:14:29 Re: error : missing chunk number 3 for toast value 14146136 in pg_toast_8895383