Skip site navigation (1) Skip section navigation (2)

Re: Postgres restore help

From: Alessandro Gagliardi <alessandro(at)path(dot)com>
To: Piyush Lenka <lenka(dot)piyush(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Postgres restore help
Date: 2012-02-28 18:30:19
Message-ID: CAAB3BBJhqtK2ioWhKuHEwjB1jShUOdnEWmRe5VK3XroeGxeLuw@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
I would recommend restoring the table to a temporary table and then using
something like:
INSERT INTO main_table SELECT temp_table.* FROM temp_table JOIN main_table
USING (pk) WHERE main_table.pk IS NULL
Someone else here might have a more efficient way of phrasing that insert
statement (I'm still fairly new to the concept of anti-joins). But I think
something like this should work for you.

-Alessandro

On Tue, Feb 28, 2012 at 7:34 AM, Piyush Lenka <lenka(dot)piyush(at)gmail(dot)com>wrote:

> Hi,
> I m trying to restore only data from a backup file.but i hav some primary
> key that already exists in the table.
> *I want to restore non duplicate data only.*
> *Please Help.*
> *
> *
> Thanks And Regards
> Piyush
>

In response to

Responses

pgsql-novice by date

Next:From: Bartosz DmytrakDate: 2012-02-28 20:13:11
Subject: Re: Postgres restore help
Previous:From: Piyush LenkaDate: 2012-02-28 15:34:09
Subject: Postgres restore help

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group