试图安装postgis get error:语法错误,位于或接近“postgis\u lib\u version”

2024-04-23 10:35:03 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试安装postgis并尝试将其与我的django集成。我在这里学习this教程。上面写着

after connecting to db we need to add geo-extensions:

-- Enable PostGIS (includes raster)
CREATE EXTENSION postgis;
-- Enable Topology
CREATE EXTENSION postgis_topology;
-- fuzzy matching needed for Tiger
CREATE EXTENSION fuzzystrmatch;
-- Enable US Tiger Geocoder
CREATE EXTENSION postgis_tiger_geocoder;
check POSTGIS version:

postgis_lib_version();
as a tupple we add it to django settings:

POSTGIS_VERSION = (2, 1, 3)

我就是这么做的

mst=# \connect school
psql (10.5, server 10.4)
You are now connected to database "school" as user "mst".
school=# CREATE EXTENSION postgis;
CREATE EXTENSION
school=# CREATE EXTENSION postgis_topology;
CREATE EXTENSION
school=# CREATE EXTENSION fuzzystrmatch;
CREATE EXTENSION
school=# CREATE EXTENSION postgis_tiger_geocoder;
CREATE EXTENSION
school=# postgis_lib_version();
ERROR:  syntax error at or near "postgis_lib_version"
LINE 1: postgis_lib_version();

任何关于我为什么会犯这个错误的建议。任何我可能遗漏或做错的事情??你知道吗


Tags: todjangoaddenableversionlibcreateextension