The `postgresql-upgrade.sh` script arranges to run `pg_upgrade` after a major PostgreSQL version update. It's scheduled by a systemd unit, _postgresql-upgrade.service_, which runs only after an OS update.