postgresql WSL 2上的PostGIS-扩展名“postgis”没有安装脚本,也没有版本X.X.X的更新路径

jk9hmnmh  于 2023-11-18  发布在  PostgreSQL
关注(0)|答案(3)|浏览(281)

我正在尝试为一个django项目在我的WSL 2(Ubuntu 20.04)上添加PostGIS扩展到postgresql数据库。
我已经安装了postgresql,postgis和所有依赖项,如下所示:

sudo apt -y install postgresql-12 postgresql-client-12
sudo apt install postgis postgresql-12-postgis-3
sudo apt-get install postgresql-12-postgis-3-scripts

字符串
一切正常。
在postgresql中,我已经创建了我的数据库并连接到它:

sudo -u postgres psql -p 5432 -h 127.0.0.1 

postgres=# CREATE DATABASE dbname;
postgres=# \c dbname;


但是,当我尝试添加postGIS扩展时:

postgres=# CREATE EXTENSION postgis;


我得到以下错误:

错误:扩展名“postgis”没有安装脚本,也没有版本“3.1.0”的更新路径

尽管在stackoverflow上搜索了类似的问题,但我找不到任何令人满意的解决方案。任何想法都可能是错误的,我如何解决它?谢谢!
编辑:以下命令

ls $(pg_config --sharedir)/extension/postgis*


我得到以下文件列表:

/usr/share/postgresql/12/extension/postgis--2.0.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.0.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.0.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.0.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.0.4--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.0.5--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.0.6--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.0.7--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.1.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.1.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.1.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.1.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.1.4--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.1.5--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.1.6--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.1.7--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.1.8--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.1.9--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.2.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.2.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.2.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.2.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.2.4--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.2.5--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.2.6--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.2.7--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.2.8--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.3.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.3.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.3.10--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.3.11--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.3.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.3.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.3.4--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.3.5--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.3.6--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.3.7--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.3.8--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.3.9--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.4.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.4.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.4.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.4.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.4.4--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.4.5--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.4.6--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.4.7--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.4.8--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.4.9--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.5.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.5.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.5.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.5.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.5.4--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--2.5.5--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--3.0.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--3.0.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--3.0.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--3.0.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--3.1.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--3.1.0--3.1.0next.sql
/usr/share/postgresql/12/extension/postgis--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--3.1.0dev--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--3.1.0next--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--ANY--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--unpackaged--3.1.0.sql
/usr/share/postgresql/12/extension/postgis--unpackaged.sql
/usr/share/postgresql/12/extension/postgis.control
/usr/share/postgresql/12/extension/postgis_raster--2.0.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.0.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.0.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.0.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.0.4--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.0.5--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.0.6--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.0.7--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.1.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.1.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.1.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.1.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.1.4--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.1.5--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.1.6--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.1.7--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.1.8--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.1.9--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.2.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.2.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.2.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.2.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.2.4--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.2.5--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.2.6--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.2.7--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.2.8--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.3.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.3.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.3.10--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.3.11--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.3.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.3.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.3.4--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.3.5--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.3.6--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.3.7--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.3.8--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.3.9--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.4.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.4.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.4.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.4.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.4.4--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.4.5--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.4.6--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.4.7--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.4.8--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.4.9--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.5.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.5.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.5.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.5.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.5.4--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--2.5.5--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--3.0.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--3.0.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--3.0.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--3.0.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--3.1.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--3.1.0--3.1.0next.sql
/usr/share/postgresql/12/extension/postgis_raster--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--3.1.0dev--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--3.1.0next--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--ANY--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--unpackaged--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_raster--unpackaged.sql
/usr/share/postgresql/12/extension/postgis_raster.control
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.0.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.0.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.0.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.0.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.0.4--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.0.5--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.0.6--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.0.7--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.1.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.1.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.1.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.1.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.1.4--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.1.5--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.1.6--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.1.7--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.1.8--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.1.9--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.2.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.2.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.2.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.2.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.2.4--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.2.5--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.2.6--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.2.7--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.2.8--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.3.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.3.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.3.10--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.3.11--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.3.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.3.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.3.4--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.3.5--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.3.6--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.3.7--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.3.8--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.3.9--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.4.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.4.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.4.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.4.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.4.4--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.4.5--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.4.6--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.4.7--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.4.8--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.4.9--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.5.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.5.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.5.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.5.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.5.4--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--2.5.5--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--3.0.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--3.0.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--3.0.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--3.0.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--3.1.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--3.1.0--3.1.0next.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--3.1.0dev--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--3.1.0next--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--ANY--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder--unpackaged--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_tiger_geocoder.control
/usr/share/postgresql/12/extension/postgis_topology--2.0.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.0.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.0.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.0.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.0.4--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.0.5--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.0.6--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.0.7--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.1.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.1.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.1.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.1.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.1.4--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.1.5--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.1.6--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.1.7--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.1.8--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.1.9--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.2.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.2.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.2.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.2.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.2.4--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.2.5--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.2.6--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.2.7--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.2.8--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.3.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.3.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.3.10--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.3.11--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.3.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.3.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.3.4--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.3.5--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.3.6--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.3.7--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.3.8--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.3.9--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.4.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.4.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.4.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.4.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.4.4--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.4.5--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.4.6--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.4.7--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.4.8--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.4.9--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.5.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.5.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.5.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.5.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.5.4--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--2.5.5--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--3.0.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--3.0.1--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--3.0.2--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--3.0.3--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--3.1.0--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--3.1.0--3.1.0next.sql
/usr/share/postgresql/12/extension/postgis_topology--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--3.1.0dev--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--3.1.0next--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--ANY--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--unpackaged--3.1.0.sql
/usr/share/postgresql/12/extension/postgis_topology--unpackaged.sql
/usr/share/postgresql/12/extension/postgis_topology.control


postgis.控制的内容:

comment = 'PostGIS geometry and geography spatial types and functions'
default_version = '3.1.0'
module_pathname = '$libdir/postgis-3'
relocatable = false

zpjtge22

zpjtge221#

把这个留给使用pgAdmin的人。
我尝试通过右键单击扩展->创建来安装PostGis
在对话框中,我没有选择“postgis”,只有“postgis-3”。我试了试,得到了错误消息error extension postgis 3 has no installation script nor update path for version,导致我到这个SO帖子。
但是使用SQL工具而不是对话框工作!

  • 右键单击数据库
  • 查询工具
  • CREATE EXTENSION postgis CASCADE;
zbsbpyhn

zbsbpyhn2#

老帖子,但我今天遇到了这个,因为我面临着完全相同的问题。
我发现我有三个不同的集群在线(运行pg_lsclusters),我的psql会话连接到一个不同的集群,而不是postgis安装到的集群。postgis 3.1.4扩展安装文件将连接到我的postgres 14(/usr/share/postgresql/14/extension/),而psql默认连接到我的postgres 12。从一个安装文件到另一个安装文件不起作用。
至少我能够使用pg_lsclusters识别端口,并将-p选项传递给psql,然后我的包含“CREATE EXTENSION postgis”的脚本运行良好。
如果我在这方面有所改进,我会再次发表评论。
最新消息:我已经决定创建一个文件~/.postgresqlrc来引导postgresql默认为我想要的版本(postgis安装的地方),包含内容:

14 main postgres

字符串

ltqd579y

ltqd579y3#

TL;DR版本.
细节...

在我的例子中,它只是Linux,而不是WSL。但情况看起来是一样的。控制文件在那里(它告诉它要找哪个版本),安装sql文件(在最初的帖子中是postgis--3.1.0.sql)在那里,但错误说它不在。我使用psql运行CREATE EXTENSION postgis;命令。
我想要一个特定的postgis版本,所以我从源代码中构建了一个tgz并安装了它。(也许这就是为什么没有postinstall钩子重新启动postgres.也许WSL在这方面是一样的,即使使用了apt-get)。我一开始有一个不同的错误:

ERROR:  could not open extension control file "/usr/share/postgresql/${postgres_version}/extension/postgis.control": No such file or directory

字符串
该文件在包中丢失,但我在源代码树中找到了它,所以我复制了它,然后得到了与原始帖子相同的错误:

ERROR:  extension "postgis" has no installation script nor update path for version "${postgis_version}"


所以,我摆弄了一下,看到安装的sql文件存在于正确的路径

/usr/share/postgresql/${postgres_version}/extension/postgis--${postgis_version}.sql


基于此,我认为没有什么需要的.正确的文件就在它们需要的地方。所以最终只是猜测并重新启动postgresql服务器,然后CREATE EXTENSION postgis;工作了。

相关问题