Upgrade GCP hosted PostgreSQL while keeping existing user passwords

google-cloud-platformpostgresql

I have been tasked with upgrading our GCP hosted PostgreSQL databases from version 9.6 to version 13.

The instructions I found (https://cloud.google.com/sql/docs/postgres/upgrade-db)
say that we need to create a new database and then
"Make sure the target instance has… The same user accounts, with the same PostgreSQL privileges and passwords"

We have a number of databases with dozens of users and roles, we allow users to connect directly and set their own passwords.
We would like to perform the database upgrade without changing all the passwords.

I've looked at using pg_dumpall to copy the users to a new database, but it fails as I don't have permission to read pg_authid.
It seems that we need a superuser account to be able to read pg_authid, and GCP does not permit superuser accounts.

Is there any way to upgrade the databases and keep the existing passwords?

Best Answer

It seems that there wasn't a way to do this at the time I asked the question, but things have moved on since then.

Google Cloud SQL now provides in-place major version upgrades, which will keep the existing user passwords.

https://cloud.google.com/sql/docs/postgres/upgrade-major-db-version-inplace