PostgreSQL restore existing rows without drop table

1k views Asked by At

I have been trying to backup and restore PostgreSQL. But, I have a problem that I have to restore existing data without drop table.

I tried normal backup and restore, I got few error messages like below.

psql:test.sql:29: ERROR:  relation "myTable" already exists
ALTER TABLE
psql:test.sql:5391: ERROR:  duplicate key value violates unique constraint "myTable_pkey"
DETAIL:  Key (name, metric, ts)=(group/devubuntu, cpu\%util, 1503360000) already exists.
CONTEXT:  COPY myTable, line 1
psql:test.sql:5399: ERROR:  multiple primary keys for table "myTable" are not allowed

Is there any way to restore existing data without deleting rows or drop table?

I know -clean option, but it's not for my situation.

0

There are 0 answers