Problems with restoring data (using pg_restore)

From: Christian Andersen <christianhelring(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Problems with restoring data (using pg_restore)
Date: 2012-04-13 17:47:58
Message-ID: 21933873.395.1334339278122.JavaMail.geo-discussion-forums@ynhh34
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi guys,

I have a script exporting a series of schemas from one database (test) to another database (production). I´ve noticed that some of the tables are not correctly updated resulting in old datas in the productiondb. I´ve looked in the logfiles and noticed the following:

CMD: E:\spatialsuite\app\postgres\8.4.6\pgsql\bin\pg_re store -c -h localhost -p 5432 -U k175 -d k175 E:\spatialsuite\sites\webgis\import\db\k175_test.r k_grundkort.dmp
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 3344; 2606 1411043 CONSTRAINT husnr_pk k175_test
pg_restore: [archiver (db)] could not execute query: ERROR: constraint "husnr_pk" of relation "husnr" does not exist
Command was: ALTER TABLE ONLY rk_grundkort.husnr DROP CONSTRAINT husnr_pk;
pg_restore: [archiver (db)] Error from TOC entry 2975; 1259 1411038 TABLE husnr k175_test
pg_restore: [archiver (db)] could not execute query: ERROR: cannot drop table husnr because other objects depend on it
DETAIL: view husnr_view depends on table husnr
HINT: Use DROP ... CASCADE to drop the dependent objects too.
Command was: DROP TABLE rk_grundkort.husnr;
pg_restore: [archiver (db)] Error from TOC entry 10; 2615 25698 SCHEMA rk_grundkort k175_test
pg_restore: [archiver (db)] could not execute query: ERROR: cannot drop schema rk_grundkort because other objects depend on it
DETAIL: table husnr depends on schema rk_grundkort
view husnr_view depends on schema rk_grundkort
HINT: Use DROP ... CASCADE to drop the dependent objects too.
Command was: DROP SCHEMA rk_grundkort;
pg_restore: [archiver (db)] could not execute query: ERROR: schema "rk_grundkort" already exists
Command was: CREATE SCHEMA rk_grundkort;
pg_restore: [archiver (db)] Error from TOC entry 2975; 1259 1411038 TABLE husnr k175_test
pg_restore: [archiver (db)] could not execute query: ERROR: relation "husnr" already exists
Command was: CREATE TABLE husnr (
ogc_fid integer NOT NULL,
wkb_geometry public.geometry,
adr_id character(11),
komnr int...
pg_restore: [archiver (db)] Error from TOC entry 3355; 0 1411038 TABLE DATA husnr k175_test
pg_restore: [archiver (db)] COPY failed: ERROR: duplicate key value violates unique constraint "husnr_pkey"
CONTEXT: COPY husnr, line 1: "1 0101000020E8640000295C8F0277E0254191ED7C27178F5741 1750702333 175 Rødovre Kommune ..."
pg_restore: [archiver (db)] Error from TOC entry 3344; 2606 1411043 CONSTRAINT husnr_pk k175_test
pg_restore: [archiver (db)] could not execute query: ERROR: multiple primary keys for table "husnr" are not allowed
Command was: ALTER TABLE ONLY husnr
ADD CONSTRAINT husnr_pk PRIMARY KEY (ogc_fid);
WARNING: errors ignored on restore: 7

The pg_dump command is:

pg_dump -h localhost -p 5432 -U k175_test -Ft -v -c -x -O -n rk_grundkort -f E:\spatialsuite\sites\test-webgis\export2webgis\db\k175_test.rk_grundkort.dmp k175_test

I´ve an idea that the problem could be related to the "-n" option.

Could someone guide me in the right direction on how to solve this problem?

Thanks

Christian

Browse pgsql-general by date

  From Date Subject
Next Message Jack Christensen 2012-04-13 17:59:20 Re: Subselect with incorrect column not a syntax error?
Previous Message Bryan Hughes 2012-04-13 17:27:13 Tab completion not working on OSX Lion (10.7.3)