pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedPg_Restore with --clean option
3+ messages / 3 participants
[nested] [flat]
* Pg_Restore with --clean option
@ 2009-10-01 05:14 Jyoti Seth <jyotiseth2001@gmail.com>
2009-10-01 06:05 ` Re: Pg_Restore with --clean option Peter Eisentraut <peter_e@gmx.net>
2009-10-01 06:37 ` Re: Pg_Restore with --clean option Scott Marlowe <scott.marlowe@gmail.com>
0 siblings, 2 replies; 3+ messages in thread
From: Jyoti Seth @ 2009-10-01 05:14 UTC (permalink / raw)
To: pgsql-sql
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.
But this is throwing error: duplicate key value violates unique constraint.
How can I restore the data to a table that already has data?
Thanks,
--
View this message in context: http://www.nabble.com/Pg_Restore-with---clean-option-tp25693180p25693180.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Pg_Restore with --clean option
2009-10-01 05:14 Pg_Restore with --clean option Jyoti Seth <jyotiseth2001@gmail.com>
@ 2009-10-01 06:05 ` Peter Eisentraut <peter_e@gmx.net>
1 sibling, 0 replies; 3+ messages in thread
From: Peter Eisentraut @ 2009-10-01 06:05 UTC (permalink / raw)
To: Jyoti Seth <jyotiseth2001@gmail.com>; +Cc: pgsql-sql
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.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Pg_Restore with --clean option
2009-10-01 05:14 Pg_Restore with --clean option Jyoti Seth <jyotiseth2001@gmail.com>
@ 2009-10-01 06:37 ` Scott Marlowe <scott.marlowe@gmail.com>
1 sibling, 0 replies; 3+ messages in thread
From: Scott Marlowe @ 2009-10-01 06:37 UTC (permalink / raw)
To: Jyoti Seth <jyotiseth2001@gmail.com>; +Cc: pgsql-sql
On Wed, Sep 30, 2009 at 11:14 PM, Jyoti Seth <jyotiseth2001@gmail.com> 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.
You could run truncate on the table then just restore its data from
the other machine. If you still get dups then there's dups in the
original data.
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2009-10-01 06:37 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2009-10-01 05:14 Pg_Restore with --clean option Jyoti Seth <jyotiseth2001@gmail.com>
2009-10-01 06:05 ` Peter Eisentraut <peter_e@gmx.net>
2009-10-01 06:37 ` Scott Marlowe <scott.marlowe@gmail.com>
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