[postgis-users] pgrestore

Sylvain Racine syracine at sympatico.ca
Fri Apr 15 04:19:07 PDT 2011


Hello,

It seems that you try to restore a backup into a database who included 
already PostGIS functions. To restore a PostGIS database, you have to 
create first an empty database WITHOUT POSTGIS functions. plpgsql 
language must be not created too.

You have 3 options. You restore your backup file into an empty database. 
If you use this option, it is important to note that your PostGIS backup 
file must include the same version of PostGIS that the one your 
installation is.

If not, you need to have to do the 2nd option who is to use the 
posgis_restore.pl script which should be located in your share/contrib 
directory. For this last option, you need to install Perl language on 
your box before. This script is a command line restore script that 
remove from your backup file the old PostGIS function and install new 
PostGIS functions. Your backup file must be in Custom format (pg_dump 
-Fc...).

If your backup is not created with -Fc option, you need to unzipped it 
(if necessary), then remove in a text editor the lines who bug. e.g. 
CREATE LANGAGE plpgsql... CREATE FUNCTION box_2d... etc. And then, 
restore your file using pgAdmin.

Hope it will be useful.

Sylvain Racine

On 2011-04-15 05:15, Raffaele Morelli wrote:
> Hi,
>
> I have a serious problem in restoring a postgis enabled database from 
> one server to another and I don't know what the problem could be.
>
> When trying to restore I got this lines (only the starting ones here) 
> from pgadmin interface. Any suggestion?
>
> best regards
> raffaele
>
> /usr/bin/pg_restore --host 127.0.0.1 --port 5432 --username rmorelli 
> --dbname cen_rf --verbose 
> "/home/rmorelli/Documents/backup/cen/cen_rf.backup"
> pg_restore: connessione al database per ripristino
> pg_restore: creazione di SCHEMA public
> pg_restore: creazione di COMMENT SCHEMA public
> pg_restore: creazione di PROCEDURAL LANGUAGE plpgsql
> pg_restore: [archiviatore (db)] Errore durante PROCESSING TOC:
> pg_restore: [archiviatore (db)] Errore nalla voce TOC 1265; 2612 49195 
> PROCEDURAL LANGUAGE plpgsql postgres
> pg_restore: [archiviatore (db)] could not execute query: ERROR:  
> language "plpgsql" already exists
>     Command was:
> CREATE PROCEDURAL LANGUAGE plpgsql;
> pg_restore: creazione di SHELL TYPE box2d
> pg_restore: [archiviatore (db)] Errore nalla voce TOC 1151; 0 0 SHELL 
> TYPE box2d postgres
> pg_restore: [archiviatore (db)] could not execute query: ERROR:  type 
> "box2d" already exists
>     Command was: CREATE TYPE box2d;
> pg_restore: creazione di FUNCTION box2d_in(cstring)
> pg_restore: [archiviatore (db)] Errore nalla voce TOC 84; 1255 49272 
> FUNCTION box2d_in(cstring) postgres
> pg_restore: [archiviatore (db)] could not execute query: ERROR:  
> function "box2d_in" already exists with same argument types
>     Command was: CREATE FUNCTION box2d_in(cstring) RETURNS box2d
>     LANGUAGE c IMMUTABLE STRICT
>     AS '$libdir/postgis-1.5', 'BOX2DFLOAT4_in';
> pg_restore: creazione di FUNCTION box2d_out(box2d)
> pg_restore: [archiviatore (db)] Errore nalla voce TOC 85; 1255 49273 
> FUNCTION box2d_out(box2d) postgres
> pg_restore: [archiviatore (db)] could not execute query: ERROR:  
> function "box2d_out" already exists with same argument types
>     Command was: CREATE FUNCTION box2d_out(box2d) RETURNS cstring
>     LANGUAGE c IMMUTABLE STRICT
>     AS '$libdir/postgis-1.5', 'BOX2DFLOAT4_...
>
> -- 
> /L'unica speranza di catarsi, ammesso che ne esista una, resta 
> affidata all'istinto di ribellione, alla rivolta non isterilita in 
> progetti, alla protesta violenta e viscerale./
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110415/a62625f1/attachment.html>


More information about the postgis-users mailing list