PostgreSQL/PostGIS在Azure DevOps Pipeline中创建扩展时寻找错误的版本文件夹

发布于 2025-01-30 19:45:38 字数 1121 浏览 3 评论 0 原文

我正在用Linux图像作为基础(Ubuntu-Latest)上的Azure Devops构建管道。在这里,我正在安装带有PostGIS的PostgreSQL版本12。 这是我安装的内容:

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

首先,我尝试将其安装而不提及任何版本号,但是后来我得到了下面提到的错误,并遵循建议以此为此。 因此,特别提到的版本号 没有特别的补充,只是Postgres的简单安装。

安装可以很好地进行,没有任何错误。

然后,当我创建数据库并连接到它时,我确实会创建扩展名为gis;而且我遇到了这个错误:

psql:./create_tables.sql:3: ERROR:  could not open extension control file "/usr/share/postgresql/14/extension/postgis.control": No such file or directory

我现在就把头发拉了一段时间,我完全没有得到有关14版文件夹的引用的位置。绝对没有安装版本14。 我还试图从postgres.org而不是Ubuntu库中提取Debian软件包,我尝试安装PostGis 2.5和PostGis 2.5脚本软件包。但是无论我做什么,我都会得到相同的结果。启动管道后,将构建图像并安装了后Ql和PostGIS,然后获得相同的错误。 有人有相同的经历吗?该版本14的此库文件夹参考可以从何而来?

编辑2022/05/21:我已经在脚本中添加了一些检查,并且在检查postgresql的版本时(通过 select> select版本(); )给出了版本14(!),至少可以解释错误。显然,版本14确实已安装并在默认端口5432。版本12上运行,该版本也明确安装了,它也可以在端口5433上运行(通过 cat /etc/postgresql/12/main/main/postgresgresql.conf.confpode/code检查>)。现在,我明确启动版本12并在脚本中连接到端口5433,因此我可以继续,但是我仍然想知道该版本14安装的来自哪里。

I'm building a pipeline on Azure DevOps with a Linux image as a base (ubuntu-latest). Here I'm installing PostgreSQL version 12 with PostGIS.
Here's what I install:

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

First I tried to install it without mentioning any version numbers, but then I got the error mentioned below and I followed recommendations to specifically do it like this.
Hence the specifically mentioned version numbers
No special additions, just a plain installation of Postgres.

Installation is going fine without any errors.

Then when I create my database and connect to it, I do CREATE EXTENSION POSTGIS; and I get this error:

psql:./create_tables.sql:3: ERROR:  could not open extension control file "/usr/share/postgresql/14/extension/postgis.control": No such file or directory

I'm pulling my hair for some time now about this and I totally don't get where it gets that reference to a version 14 folder from. There is absolutely no version 14 installed.
I also tried to pull the Debian packages from the Postgres.org instead of the Ubuntu libraries, I tried to install PostGIS 2.5 and PostGIS 2.5 scripts packages. But whatever I do, I get the same result. Once I start the pipeline, the image gets built and Postgresql and PostGIS installed and then I get the same error as a result.
Did anyone have this same experience? Where could this library folder reference for version 14 come from?

EDIT 2022/05/21: I've added some checks to the scripts and when checking the version of PostgreSQL(via SELECT version(); ) it gives version 14 (!), which at least explains the error. Apparently version 14 indeed IS installed and runs on the default port 5432. Version 12 that is explicitly installed also runs, it runs on port 5433 (checked via cat /etc/postgresql/12/main/postgresql.conf ). I now explicitly start version 12 and connect in my scripts to port 5433, so I can continue, but I still wonder where that version 14 installation comes from.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时间你老了 2025-02-06 19:45:38

Postgres 14已预安装在Microsoft托管代理上,用于Ubuntu-20

参考:

Postgres 14 is pre-installed on the Microsoft Hosted agent for ubuntu-20

Reference:
https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md#postgresql

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文