I've seen a lot of similar topics, but no any clear solution.
What i have: Production DB on Amazon RDS. I need to restore/input data to one of the tables in that DB from the dump (.backup) located on my PC.
Here is the table structure:
CREATE TABLE condos
(
name text NOT NULL,
latitude numeric,
longtitude numeric,
condo_id serial NOT NULL,
city text NOT NULL,
country text NOT NULL,
address text,
district text,
CONSTRAINT pk_condo_id PRIMARY KEY (condo_id),
CONSTRAINT uniq_title UNIQUE (name)
)
The problem: once i'm trying to restore it from local DB, i get a UNIQUE constraint violation error:
pg_restore: [archiver (db)] COPY failed for table "condos": ERROR: duplicate key value violates unique constraint "pk_condo_id"
DETAIL: Key (condo_id)=(21) already exists.
Also, there are other tables have relations with the table condos
and i don't want to update whole DB.
I know that it's not the first time i'm going to do this procedure,so my question is - what is the best & simple way to update the table and input the data into it (only the data which is not exists in the production DB's table)?