如何在 Ubuntu 20.04 上将 Postgresql 14.1 升级到 14.2?

How to upgrade Postgresql 14.1 to 14.2 on Ubuntu 20.04?

Postgresql 网站说“那些 运行 14.X 不需要 dump/restore。” (https://www.postgresql.org/docs/14/release-14-2.html#id-1.11.6.5.4)

我还需要使用pg_upgrade还是有其他升级方式?

您只需使用 Ubuntu 的包管理器更新二进制文件并重新启动 Postgres(apt update 然后 apt install postgresql-14

pg_upgrade 只需要在 主要 版本之间升级(例如从 13 到 14 或从 14 到 15)。将 14.1 升级到 14.2 是 次要 版本升级。

根据 docs:

Minor releases never change the internal storage format and are always compatible with earlier and later minor releases of the same major version number.

您正在从 14.1 升级到 14.2,因此这适用于您的情况。这意味着您可以只升级二进制文件(所以通常 apt-get update && apt-get upgrade 假设您使用的是 repo with the latest release) and restart the service. However, it is worth reviewing the release notes 特别是:

some bugs have been found that may have resulted in corrupted indexes, as explained in the first two changelog entries. If any of those cases apply to you, it's recommended to reindex possibly-affected indexes after updating.