Reputation: 14439
I have postgresql 9.3
installed on archlinux.
I am trying to restore database backup (psql <db_hame> < backup.file
) which uses postgis 2.0 functions, types etc. I tried to install postgis with pacman (pacman -S postgis
) it successfully installed but it seems that 2.0
and 2.1
versions are incompatible as I have lots of errors complaining about missing functions during database import:
ERROR: could not find function "geography_analyze" in file "/usr/lib/postgresql/postgis-2.1.so"
ERROR: function public.geography_analyze(internal) does not exist
ERROR: function geography_analyze(internal) does not exist
ERROR: could not find function "geometry_analyze_2d" in file "/usr/lib/postgresql/postgis-2.1.so"
ERROR: function public.geometry_analyze(internal) does not exist
ERROR: function geometry_analyze(internal) does not exist
ERROR: type "geometry" is only a shell
ERROR: type "public.geometry_dump" does not exist
ERROR: type "geometry" is only a shell
ERROR: type "public.valid_detail" does not exist
ERROR: SQL function cannot accept shell type geography
ERROR: function public._st_bestsrid(geography) does not exist
ERROR: PL/pgSQL functions cannot return type geometry
ERROR: function public._st_concavehull(geometry) does not exist
ERROR: type "geometry_dump" does not exist
ERROR: function public._st_dumppoints(geometry, integer[]) does not exist
ERROR: SQL function cannot accept shell type geometry
ERROR: function public._st_within(geometry, geometry) does not exist
ERROR: could not find function "geography_gist_selectivity" in file "/usr/lib/postgresql/postgis-2.1.so"
ERROR: function public.geography_gist_join_selectivity(internal, oid, internal, smallint) does not exist
ERROR: could not find function "geography_gist_selectivity" in file "/usr/lib/postgresql/postgis-2.1.so"
ERROR: function public.geography_gist_selectivity(internal, oid, internal, integer) does not exist
ERROR: could not find function "geometry_gist_joinsel_2d" in file "/usr/lib/postgresql/postgis-2.1.so"
ERROR: function public.geometry_gist_joinsel_2d(internal, oid, internal, smallint) does not exist
ERROR: could not find function "geometry_gist_sel_2d" in file "/usr/lib/postgresql/postgis-2.1.so"
ERROR: function public.geometry_gist_sel_2d(internal, oid, internal, integer) does not exist
Then I tried to build postgis package using following links: http://boringnerdystuff.wordpress.com/2012/04/14/postgis-2-0-pkgbuild-for-arch-linux/ and https://github.com/philbns/PostGIS-2.0-PKGBUILD/tree/80d8af061fa73e9a09dd6ec5c204bc4b65e38202. However build fails with following error:
lwgeom_triggers.c: In function ‘cache_bbox’:
lwgeom_triggers.c:78:33: error: dereferencing pointer to incomplete type
tupdesc = trigdata->tg_relation->rd_att;
And whole makepkg
log: http://pastebin.com/GGqECymZ
How can I import database that uses postgis 2.0 ?
Upvotes: 2
Views: 1781
Reputation: 14439
Huh, that was quite challenging to get it working.
I could not build postgis 2.0.0 against postgres 9.3, so I had to rollback to postgres 9.1.10 and build both postgress and postgis from source.
I used instructions to build postgis from http://boringnerdystuff.wordpress.com/2012/04/14/postgis-2-0-pkgbuild-for-arch-linux/ (itself package is on github: https://github.com/philbns/PostGIS-2.0-PKGBUILD).
Another problem was with postgres package. I tried 9.1.4, but it failed db initialization with some error. Finally I found 9.1.10 that could initialize db. There is no package for postgres 9.1.10, so I used package for postgres 9.1.4 (from https://projects.archlinux.org/svntogit/packages.git/commit/trunk?h=packages/postgresql&id=5bd2e474704f619449287efc7310acebcaf15ab4) then changed pkgver
to 9.1.10 crossed fingers and hoped everything to be ok. And that worked! I built postgres then postgis and installed them both.
I enabled postgis extension in my db with:
CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;
CREATE EXTENSION fuzzystrmatch;
And finally my db backup imported without any error.
Upvotes: 6