From: Peter Eisentraut <peter_e@gmx.net>
To: Jyoti Seth <jyotiseth2001@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Pg_Restore with --clean option
Date: Thu, 01 Oct 2009 09:05:53 +0300
Message-ID: <1254377153.30588.2.camel@fsopti579.F-Secure.com> (raw)
In-Reply-To: <25693180.post@talk.nabble.com>
References: <25693180.post@talk.nabble.com>
On Wed, 2009-09-30 at 22:14 -0700, Jyoti Seth wrote:
> I want to restore data of a single table. Before restoring the data I
> disabled all the triggers and constraints on that table. I used the restore
> command with --clean option so that data gets deleted from that table and
> then fresh data get inserted.
--clean drops the tables, not the data.
> But this is throwing error: duplicate key value violates unique constraint.
>
> How can I restore the data to a table that already has data?
Well, you could just not use --clean, which would insert the data into
existing tables. But if you have conflicting data in your tables, you
need a more elaborate scheme, depending on how exactly you plan to
resolve those conflicts.
I think you might be a bit confused about the proper workflow with
pg_dump and pg_restore and therefore are not giving us accurate
information. Perhaps some more detail would help.
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: pgsql-sql@postgresql.org
Cc: peter_e@gmx.net, jyotiseth2001@gmail.com
Subject: Re: Pg_Restore with --clean option
In-Reply-To: <1254377153.30588.2.camel@fsopti579.F-Secure.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox