[postgis-users] Restore data from Mac to Windows fails

Markus Schaber schabi at logix-tt.com
Wed Oct 11 03:14:07 PDT 2006


Hi, Barend,

Barend Köbben wrote:

> pg_restore: [archiver (db)] could not execute query: ERROR:  could
> not access file "$libdir/liblwgeom.1.1.so": No such file or directory
>  Command was: CREATE FUNCTION box2d_in(cstring) RETURNS box2d AS
> '$libdir/liblwgeom.1.1.so', 'BOX2DFLOAT4_in' LANGUAGE c IMMUTABLE...

Your liblwgeom.1.1.so clearly has a different name on windows, possibly
lwgeom.1.1.dll.

> The only workaround  I could find was backuing up the schema and data
> seperately as SQL inserts, then deleting the PostGIS function part
> from the schema SQL , and running bot in psql... Not very nice.
> 
> Has anybody an idea how to solve it?

One idea would be to use pg_dump in non-plaintext mode, and then use the
utils/postgis_restore.pl script that comes with PostGIS to apply the
data to an postgis-enabled database.

Another idea is to search/replace all occurences of
'$libdir/liblwgeom.1.1.so' with the .dll definition text that comes with
your windows installation, in the lwpostgis.sql file.

When your dump is to large for this to work, maybe the dump_split tool I
posted here some time ago will help you, it separates data from
metadata, so you can easily load the function definition file of
terabyte database dumps in an editor.

Another, very hackish method (and not tested yet) is to install postgis
into your template0 database on the mac server (please back it up before
you even think about doing that). Theoretically, this should produce a
pg_dump file without the postgis function definitions, which should
apply to a postgis-enabled clean database.

> PS: I noticed that what the Mac version of PGadminIII calls
> ENCODING=UNICODE, the Win version calls ENCODING=UTF8. Surely this is
> just a naming problem, not  the cause...?

No, UTF-8 and UNICODE are currently synonyms in PostgreSQL. That's not
really wise, as UTF-8 is an encoding, and UNICODE is a charset, so
adding further encodings for UNICODE will give some confusion, but
that's not your problem.

HTH,
Markus

-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org




More information about the postgis-users mailing list