Re: dump-restore only one table

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: dump-restore only one table
Дата
Msg-id 169.1178052523@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: dump-restore only one table  (Alexander Kuprijanov <sanya-spb@list.ru>)
Список pgsql-general
Alexander Kuprijanov <sanya-spb@list.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

В списке pgsql-general по дате отправления:

Предыдущее
От: "Ed L."
Дата:
Сообщение: Re: HP/Pgsql/DBD::Pg issue
Следующее
От: "Ed L."
Дата:
Сообщение: Re: HP/Pgsql/DBD::Pg issue