Search Postgresql Archives

Re: dump-restore only one table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alexander Kuprijanov <sanya-spb@xxxxxxx> 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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux