我有Postgres版本8.4.8
select version();
PostgreSQL 8.4.8 on i686-pc-linux-gnu, compiled by GCC gcc-4.4.real (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5, 32-bit通过synaptic包管理器安装Postgis (postgis和postgresql-8.4-postgis),一切似乎都很顺利。然后当我尝试验证Postgis版本时,事情并不是很好。这两种方法都会产生相同的错误。
SELECT PostGIS_version();
SELECT PostGIS_full_version();
ERROR: function postgis_full_version() does not exist
LINE 1: SELECT PostGIS_full_version();
HINT: No function matches the given name and argument types. You might need to add explicit type casts.包管理器声称Postgis已安装。如何验证安装是否有效?
发布于 2011-12-11 04:36:17
PostGIS需要在每个数据库上安装。现有数据库不会自动更改。运行安装脚本,如下所示。
在PostgreSQL 8.4中,您可能还需要创建语言plpgsql.对于9.0+,它是默认的过程语言,并且会自动安装。在数据库中:
createlang plpgsql yourdatabase不能做坏事。如果plpgsql已经安装好了,它只会产生一个错误,告诉你已经安装了。转到安装目录。在Debian Squeeze中,contrib包在这里(在Ubuntu中可能会有所不同)。在shell中:
cd /usr/share/postgresql/8.4/contrib/postgis-1.5然后执行(作为postgres用户或您必须提供用户名/ pw):
psql -d yourdatabase -f postgis.sql
psql -d yourdatabase -f spatial_ref_sys.sql您可能还想将注释安装到闪亮的新函数中(可选)。在Debian Squeeze中,安装文件位于/contrib主目录中:
cd /usr/share/postgresql/8.4/contrib
psql -d yourdatabase -f postgis_comments.sql如果您希望在默认情况下随集群中的每个新数据库一起安装PostGIS,请将其也安装到您的template1数据库中。阅读more about that in the manual。
PostGIS安装源(在Ubuntu上):
http://postgis.net/docs/manual-2.1/postgis_installation.html
http://www.paolocorti.net/2008/01/30/installing-postgis-on-ubuntu/
PostgreSQL 9.1+
在PostgreSQL 9.1或更高版本中,您可以使用更方便的CREATE EXTENSION
CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;您的发行版可能正在发布准备安装的扩展。如果没有,请考虑PostGIS手册中的"Building PostGIS Extensions and Deploying them"一章。
https://stackoverflow.com/questions/8459361
复制相似问题