gpt4 book ai didi

postgresql - 构建 postgis 2.0.0 失败

转载 作者:行者123 更新时间:2023-11-29 11:57:15 25 4
gpt4 key购买 nike

我有 postgresql 9.3安装在 archlinux 上。

我正在尝试恢复使用 postgis 2.0 函数、类型等的数据库备份 ( psql <db_hame> < backup.file )。我尝试使用 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 的数据库?

最佳答案

嗯,让它工作起来非常具有挑战性。

我无法针对 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/ 构建 postgis (本身包在 github 上:https://github.com/philbns/PostGIS-2.0-PKGBUILD)。

另一个问题是 postgres 包。我试过 9.1.4,但数据库初始化失败并出现一些错误。终于找到了可以初始化db的9.1.10。没有适用于 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;

最后我的数据库备份没有任何错误导入。

关于postgresql - 构建 postgis 2.0.0 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19484632/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com