upgrade-postgresql: Also upgrade postgresql-client.

The `pg_upgrade` tool uses `pg_dump` as an internal step, and verifies
that the version of `pg_upgrade` is the same exactly the same as the
version of the PostgreSQL server it is upgrading to.  A mismatch (even
in packaging versions) leads to it aborting:

```
/usr/lib/postgresql/14/bin/pg_upgrade -b /usr/lib/postgresql/13/bin -B /usr/lib/postgresql/14/bin -p 5432 -P 5435 -d /etc/postgresql/13/main -D /etc/postgresql/14/main --link
Finding the real data directory for the source cluster      ok
Finding the real data directory for the target cluster      ok

check for "/usr/lib/postgresql/14/bin/pg_dump" failed: incorrect version: found "pg_dump (PostgreSQL) 14.6 (Ubuntu 14.6-0ubuntu0.22.04.1)", expected "pg_dump (PostgreSQL) 14.6 (Ubuntu 14.6-1.pgdg22.04+1)"
Failure, exiting
```

Explicitly upgrade `postgresql-client` at the same time we upgrade
`postgresql` itself, so their versions match.

Fixes: #24192
This commit is contained in:
Alex Vandiver 2023-02-01 17:43:23 +00:00 committed by Tim Abbott
parent c64c00d916
commit 26696aaa53
1 changed files with 1 additions and 1 deletions

View File

@ -24,7 +24,7 @@ fi
set -x set -x
"$ZULIP_PATH"/scripts/lib/setup-apt-repo "$ZULIP_PATH"/scripts/lib/setup-apt-repo
apt-get install -y "postgresql-$UPGRADE_TO" apt-get install -y "postgresql-$UPGRADE_TO" "postgresql-client-$UPGRADE_TO"
if pg_lsclusters -h | grep -qE "^$UPGRADE_TO\s+main\b"; then if pg_lsclusters -h | grep -qE "^$UPGRADE_TO\s+main\b"; then
pg_dropcluster "$UPGRADE_TO" main --stop pg_dropcluster "$UPGRADE_TO" main --stop
fi fi