DeepSeek总结的 Postgres 18.7 的 Debian 和 RedHat 打包者保护你
发布于 2026年11月13日,作者 Jeremy ⋅ 2 条评论
分类:CVE、生态系统、扩展、升级
这是对[昨天博客]的简短快速跟进,趁我出门前。
我之前没太注意,昨天的 postgres 发布给我带来了一些惊喜。我现在正在补课。
第一:阅读 [Devrim 的博客] 和 [Lukas 的 5-minutes-of-postgres] 获取 TLDR。
第二:我在昨天的博客中提到了这一点——"RPM 打包现在会添加一个头部来要求特定的次要版本。我还没检查 Debian 生态系统,但它可能也在处理这个问题。"
我今天早上快速看了一下,Debian 打包确实有同样的保护。
这一点很重要,因为很多人今天不会升级 Postgres(即使我们告诉他们要升级)。下周他们会尝试安装某个新扩展,而他们的操作系统打包程序会尝试拉取最新版本。Devrim 和 Christoph(我们的两位主要 Postgres 打包者 ❤️)已经确保打包系统会保护你免受错误安装的影响。
## 在 Debian 上:
```bash
apt-mark hold postgresql-18
apt-get install -y postgresql-18-cron
```
关键输出(安装失败):
```
postgres (PostgreSQL) 18.6 (Debian 18.6-1.pgdg12+2)
postgresql-18-cron : Depends: postgresql-18 (> 18.7) but 18.6-1.pgdg12+2 is to be installed
E: Unable to correct problems, you have held broken packages.
```
……
允许升级:
```bash
apt-mark unhold postgresql-18
apt-get install -y postgresql-18-cron
postgres --version
```
关键输出:
```
The following packages will be upgraded:
libpq5 postgresql-18 postgresql-18-jit postgresql-client-18
Setting up postgresql-18 (18.7-1.pgdg12+2) ...
Setting up postgresql-18-cron (1.6.8-1.pgdg12+3) ...
```
……
包元数据:
```bash
apt-cache show postgresql-18-cron
```
所选候选版本的关键输出:
```
Version: 1.6.8-1.pgdg12+3
Depends: postgresql-18 (>> 18.7), libc6 (>= 2.14), libpq5 (>= 9.0~)
```
## 在 Rocky 上:
尝试在阻止 PostgreSQL 升级的情况下安装无版本扩展:
```bash
dnf install -y --exclude='postgresql18*' pg_cron_18
```
关键输出(安装失败):
```
Problem: package pg_cron_18-1.6.8-4PGDG.rhel9.8.x86_64 from pgdg18 requires postgresql18-libs(x86-64) >= 18.7, but none of the providers can be installed
- cannot install the best candidate for the job
- package postgresql18-libs-18.7-1PGDG.rhel9.8.x86_64 from pgdg18 is filtered out by exclude filtering
```
……
允许升级(上面的排除只适用于该命令):
```bash
dnf install -y pg_cron_18
rpm -q postgresql18-server pg_cron_18
rpm -q --requires pg_cron_18
```
关键输出:
```
Installing:
pg_cron_18 x86_64 1.6.8-4PGDG.rhel9.8
Upgrading:
postgresql18 x86_64 18.7-1PGDG.rhel9.8
postgresql18-libs x86_64 18.7-1PGDG.rhel9.8
postgresql18-server x86_64 18.7-1PGDG.rhel9.8
postgresql18-server-18.7-1PGDG.rhel9.8.x86_64
pg_cron_18-1.6.8-4PGDG.rhel9.8.x86_64
```
……
相关的 RPM 依赖要求:
```
postgresql18-libs(x86-64) >= 18.7
postgresql18-server
```
今天在 Kubernetes 上运行 Postgres 的大多数人都在构建自己的容器镜像,将扩展内置到自定义容器镜像中。构建这些镜像最常见的方式是直接使用 Debian 包。上述打包保护也会保护这些用户——如果你的容器构建成功,你就拥有了正确的版本组合。
CloudNativePG 为 Postgres 18 及更新版本提供扩展容器。如果你使用 CNPG 扩展目录,那么你会受到保护,因为它们实际上是滚动发布;昨天我们确保扩展目录拥有核心 postgres 和所有扩展的最新版本——你总是获得最新的 PG 次要版本和最新的扩展版本。
然而,如果你独立于 Postgres 服务器摘要/版本手动选择并固定扩展容器摘要/版本,那么确保不混用不兼容的扩展和服务器版本就是你的责任。
真正需要小心的是那些不使用打包生态系统、从源码构建和安装扩展(和/或数据库)的人。如果你自己管理 postgres 生态代码的构建/CI,那么下周你应该忙于处理这个最新的 Postgres 次要版本。
分享此内容:
openEuler 是由开放原子开源基金会孵化的全场景开源操作系统项目,面向数字基础设施四大核心场景(服务器、云计算、边缘计算、嵌入式),全面支持 ARM、x86、RISC-V、loongArch、PowerPC、SW-64 等多样性计算架构
更多推荐


所有评论(0)