public inbox for [email protected]  
help / color / mirror / Atom feed
From: Ray O'Donnell <[email protected]>
To: Andrus <[email protected]>
To: pgsql-general <[email protected]>
Subject: Re: How to get single table data from backup
Date: Fri, 19 Dec 2025 16:12:40 +0000
Message-ID: <0102019b37627d9c-03ffe58c-44b4-4245-8cde-fb8f84b97509-000000@eu-west-1.amazonses.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

On 19/12/2025 12:41, Andrus wrote:

> Hi!
>
> Large database backup is created using
>
> pg_dump -b -f backup.backup -F c
>
> How to restore single table in schema firma2 from it in Windows?
>
> Created database recovery and tried
>
> pg_restore --schema-only --n firma2 -d recovery backup.backup
> pg_restore -n firma2 -t tabletorecover -d recovery backup.backup
>
> This fails since tabletorecover contains lot foreign key references. 
> Foreign keys refer to other tables which have foreign keys to another 
> tables etc. making huge graph. All tables contain also data.
>
I haven't tried it, but - off the top of my head - how about:

(i) Create the table separately by hand, without the FK references.

(ii) Do a data-only restore, using the -a and -t options to pg_restore


Ray.




> I need to get table data only. Using PostgresSql 17 in windows.
>
> Andrus.
>
>
-- 
Ray O'Donnell // Galway // Ireland
[email protected]







view thread (6+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: How to get single table data from backup
  In-Reply-To: <0102019b37627d9c-03ffe58c-44b4-4245-8cde-fb8f84b97509-000000@eu-west-1.amazonses.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox