# 面向自托管用户的 PostgreSQL 18 更新

**URL:** <https://meta.discourse.org/t/postgresql-18-update-for-self-hosters/406194>\
**Category:** Announcements\
**Created:** [2026年八月3日 04:36 UTC](https://meta.discourse.org/t/postgresql-18-update-for-self-hosters/406194 "2026-08-03T04:36:42Z")\
**Posts on this page:** 1\
**Showing post:** 76

<div class="post-metadata">

**Author:** ![Ethsim2](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ethsim2/32/522255_2.png) [@Ethsim2](https://meta.discourse.org/u/Ethsim2)\
**Post date:** [2026年八月25日 08:14 UTC](https://meta.discourse.org/t/postgresql-18-update-for-self-hosters/406194/76 "2026-08-25T08:14:57Z")

</div>

> [@Saiano](#):
>
> 同样的错误

我认为我找到了原因。

当前的基础镜像安装了 PostgreSQL 18 服务器，但 `postgres.15.template.yml` 仍然假设 PostgreSQL 15 服务器软件包已经存在。因此，在 `/etc/postgresql/15/main/postgresql.conf` 文件存在之前，脚本就尝试访问它，从而产生了上述的 ENOENT 错误。

我提交了一个小的 PR，该 PR 让 PostgreSQL 15 的保留模板在配置 PostgreSQL 之前，先移除 PostgreSQL 18 服务器软件包并安装 PostgreSQL 15 服务器软件包：

> <https://github.com/discourse/discourse_docker/pull/1120>
>
> \`postgres.15.template.yml\` currently assumes that the PostgreSQL 15 server
> pack…ages are installed by the base image.
> 
> Since the base image moved to PostgreSQL 18, selecting
> \`templates/postgres.15.template.yml\` to postpone the PostgreSQL 18 upgrade
> fails during bootstrap with:
> 
> Errno::ENOENT: No such file or directory @ rb\_sysopen -
> /etc/postgresql/15/main/postgresql.conf
> 
> Install the PostgreSQL 15 server packages in the PostgreSQL 15 template,
> after removing the PostgreSQL 18 server packages.
> 
> This restores the intended PostgreSQL 15 holdback path.

这应该能恢复预期的路径，即通过将 `postgres.template.yml` 更改为 `postgres.15.template.yml` 来推迟 PostgreSQL 18 的升级。

---

_[View the full topic](https://meta.discourse.org/t/postgresql-18-update-for-self-hosters/406194)._
