Re: How to get some table entries from backup instance back to production instance

From: daku(dot)sandor(at)gmail(dot)com
To: Marcel Ruff <mr(at)marcelruff(dot)info>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: How to get some table entries from backup instance back to production instance
Date: 2015-02-10 09:04:00
Message-ID: 7302ABEA-C622-4DD3-8913-DE33C855FA77@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


Hi,

I would do this way:
After the first step select the required records into another tables with CREATE TABLE patmp AS SELECT * FROM pa WHERE ...
Move these temporary tables to the prod database by dump and restore and transfer the content into the prod tables with INSERT INTO pa SELECT * FROM patmp.
Done.

Regards,
Sándor Daku

> On 10 Feb 2015, at 09:39, Marcel Ruff <mr(at)marcelruff(dot)info> wrote:
>
> Hi,
>
> I have 4 tables with 1:n relation:
>
> grandpa -> pa -> child -> grandchild
>
> Now I need to copy an instance of "pa" with his descendants
> from my backup (a postgres dump) back to prod.
> "grandchild" has a blob column (containing fotos)
>
> Which options do I have?
>
> 1) Import the backup dump in a separate postgres instance
> 2) Do some magic query which created insert statements
> 3) Run the insert statements on the prod server
>
> What is the best approach, and how does a query look like which
> returns nicely formatted insert lines?
>
> Thank you
> Marcel
>

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Martin Steer 2015-02-10 12:36:01 Re: How to get some table entries from backup instance back to production instance
Previous Message Florian Schaetz 2015-02-10 08:46:08 Problem: Temporary tables not really temporary tables