Re: Backup Restore - Mailing list pgsql-general

From Richard Huxton
Subject Re: Backup Restore
Date
Msg-id 459A2D47.4020206@archonet.com
Whole thread Raw
In response to Re: Backup Restore  (Bob Pawley <rjpawley@shaw.ca>)
List pgsql-general
Bob Pawley wrote:
> Following is the error message on pg_restore:-
>
> "pg_restore: ERROR:  duplicate key violates unique constraint
> "spatial_ref_sys_pkey"
> CONTEXT:  COPY spatial_ref_sys, line 1: "2000 EPSG 2000 PROJCS["Anguilla
> 1957 / British West Indies Grid",GEOGCS["Anguilla 1957",DATUM["Angui..."
> pg_restore: [archiver (db)] error returned by PQendcopy: ERROR:
> duplicate key violates unique constraint "spatial_ref_sys_pkey"
> CONTEXT:  COPY spatial_ref_sys, line 1: "2000 EPSG 2000 PROJCS["Anguilla
> 1957 / British West Indies Grid",GEOGCS["Anguilla 1957",DATUM["Angui..."
> pg_restore: *** aborted because of error
>
> Process returned exit code 1."
>
> The GIS feature was removed from the PostgreSQL application before the
> project dump.

Not sure what you mean by that - you removed all GIS related types and
functions from the source database?

> Anyone have any thoughts on how to get around this??

Remove the constraint if you no longer have that requirement. It looks
like you have a primary-key defined on spatial_ref_sys and want to
remove it. See the SQL Reference section of the manuals for how to use
ALTER TABLE to drop primary keys and other constraints.

I'm curious as to how this can happen though. Are the definitions of
table spatial_ref_sys the same in the source and target database?

--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: Why ContinueUpdateOnError is not implemented in npgsql
Next
From: Alban Hertroys
Date:
Subject: Re: [ADMIN] OUTER JOIN IS SLOW