2013-10-21 145 views
1

我在archlinux上安裝了postgresql 9.3build postgis 2.0.0失敗

我試圖還原數據庫備份(psql <db_hame> < backup.file),它採用了PostGIS 2.0功能,類型等我試圖安裝使用pacman(pacman -S postgis)PostGIS的它安裝成功,但它似乎2.02.1版本不兼容,因爲我有很多錯誤抱怨數據庫導入過程中丟失功能:

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 

然後我試圖建立使用以下鏈接PostGIS的包:http://boringnerdystuff.wordpress.com/2012/04/14/postgis-2-0-pkgbuild-for-arch-linux/https://github.com/philbns/PostGIS-2.0-PKGBUILD/tree/80d8af061fa73e9a09dd6ec5c204bc4b65e38202。但是構建失敗,以下錯誤:

lwgeom_triggers.c: In function ‘cache_bbox’: 
lwgeom_triggers.c:78:33: error: dereferencing pointer to incomplete type 
    tupdesc = trigdata->tg_relation->rd_att; 

和全makepkg日誌:http://pastebin.com/GGqECymZ

我怎麼能導入使用的PostGIS 2.0數據庫?

回答

3

嗯,這是相當具有挑戰性的得到它的工作。

我無法在postgres 9.3上創建postgis 2.0.0,所以我不得不回滾到postgres 9.1.10,並從源代碼構建postgress和postgis。

我使用指令從http://boringnerdystuff.wordpress.com/2012/04/14/postgis-2-0-pkgbuild-for-arch-linux/(本身包在github上:https://github.com/philbns/PostGIS-2.0-PKGBUILD)構建postgis。

另一個問題是使用postgres軟件包。我試過9.1.4,但是它失敗了db初始化有一些錯誤。最後我發現9.1.10可以初始化db。沒有用於postgres 9.1.10的包,所以我使用postgres 9.1.4的包(從https://projects.archlinux.org/svntogit/packages.git/commit/trunk?h=packages/postgresql&id=5bd2e474704f619449287efc7310acebcaf15ab4),然後將pkgver更改爲9.1.10交叉的手指,並希望一切都可以。這工作!我建立了postgres然後postgis並且安裝了它們。

我啓用了PostGIS擴展在我的分貝:

CREATE EXTENSION postgis; 
CREATE EXTENSION postgis_topology; 
CREATE EXTENSION fuzzystrmatch; 

最後我的數據庫備份沒有任何錯誤進口。