Re: Postgres restore help - Mailing list pgsql-novice

From Alessandro Gagliardi
Subject Re: Postgres restore help
Date
Msg-id CAAB3BBJhqtK2ioWhKuHEwjB1jShUOdnEWmRe5VK3XroeGxeLuw@mail.gmail.com
Whole thread Raw
In response to Postgres restore help  (Piyush Lenka <lenka.piyush@gmail.com>)
Responses Re: Postgres restore help  (Bartosz Dmytrak <bdmytrak@eranet.pl>)
List 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.piyush@gmail.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

pgsql-novice by date:

Previous
From: Piyush Lenka
Date:
Subject: Postgres restore help
Next
From: Bartosz Dmytrak
Date:
Subject: Re: Postgres restore help