Re: dump-restore only one table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alexander Kuprijanov <sanya-spb(at)list(dot)ru>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: dump-restore only one table
Date: 2007-05-01 20:48:43
Message-ID: 169.1178052523@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alexander Kuprijanov <sanya-spb(at)list(dot)ru> writes:
> % pg_dump -d test_a --table=b -F c -v -f b.backup

That syntax doesn't actually work in any reasonably modern version
of pg_dump ... what are you really typing? (-d is not a switch for
specifying the database name.)

But at any rate, I still can't duplicate the behavior you show of
pg_restore not trying to restore the data. What I get with this
test case (after fixing the command syntax) is

pg_restore: connecting to database for restore
pg_restore: restoring data for table "b"
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 1612; 0 67454 TABLE DATA b sanya
pg_restore: [archiver (db)] COPY failed: ERROR: duplicate key violates unique constraint "b_pkey"
CONTEXT: COPY b, line 1: "1 3"
WARNING: errors ignored on restore: 1

which is what I'd expect given that there's conflicting data
already in the destination table. Are you looking for an option to
delete the destination's existing data? There isn't one in the
--data-only mode, AFAIR, but you could instead use the -c option
to drop and recreate the table.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ed L. 2007-05-01 20:49:44 Re: HP/Pgsql/DBD::Pg issue
Previous Message Ed L. 2007-05-01 20:46:44 Re: HP/Pgsql/DBD::Pg issue