Postgresql 10 to 12 Upgrade

I just finished a gnarly postgresql migration @ home for my personal stuff. Started Thursday night, was slowly chipping away at it all weekend.

Main lessons learned:

Do not try to cross-upgrade extensions. If you're upgrading postgres from e.g. 10 to 12, keep extensions (for me postgis and timescaleb) the same version.

This can be hard with strictly apt packages on one version of Ubuntu, making intermediate versions of your database that run in docker and are able to install old versions of things is nice.

It was much easier to upgrade extensions on v10 to match the installable versions on v12 than to go the other way.

Always remember to backup and validate your backup before you try anything like this!


Saving this here, mostly for myself.

/usr/lib/postgresql/12/bin/pg_upgrade --old-datadir=/virt/postgresql_data/postgresql/10/main --new-datadir=/virt/postgresql_data/postgresql/12/main --old-bindir=/usr/lib/postgresql/10/bin --new-bindir=/usr/lib/postgresql/12/bin --old-options '-c config_file=/etc/postgresql/10/main/postgresql.conf' --new-options '-c config_file=/etc/postgresql/12/main/postgresql.conf'


Comments and Messages

I won't ever give out your email address. I don't publish comments but if you'd like to write to me then you could use this form.

Issac Kelly