The following bug has been logged on the website:
Bug reference: 17347
Logged by: Mathias Kunter
Email address: mathiaskunter@gmail.com
PostgreSQL version: 12.9
Operating system: Debian 10.11
Description:
When upgrading a PostgreSQL cluster with pg_upgrade (tested while upgrading
from 11.14 to 12.9, but supposedly affects all versions), and the --new-port
argument is used to specify a new port number for the upgraded cluster, then
the generated analyze_new_cluster script will connect to and analyze a
different cluster instead of the upgraded one.
The vacuumdb command found within the analyze_new_cluster script should
explicitly specify the port number of the upgraded cluster, so that it will
actually analyze the correct cluster after the upgrade.