Created
September 23, 2022 09:10
-
-
Save daz/477190328f5f20121c26c42ef8fbedbc to your computer and use it in GitHub Desktop.
Upgrading postgresql 12 to 14 homebrew with postgis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew install postgresql | |
brew services stop postgresql | |
pg_upgrade --old-bindir=/opt/homebrew/opt/postgresql@12/bin \ | |
--new-bindir=/opt/homebrew/opt/postgresql@14/bin \ | |
--old-datadir=/opt/homebrew/var/postgresql@12 \ | |
--new-datadir=/opt/homebrew/var/postgres \ | |
--check | |
# If you're getting non-empty database errors for the new database, rename the directory to a backup and init a new db: | |
mv /opt/homebrew/var/postgres /opt/homebrew/var/postgres_backup | |
# Locale needs to match the old data | |
initdb --locale="en_US.UTF-8" -D /opt/homebrew/var/postgres | |
# Might need to do this | |
/opt/homebrew/opt/postgresql@14/bin/pg_resetwal /opt/homebrew/var/postgres | |
# Needed to run this on the @12 database as a superuser | |
# https://postgis.net/2022/08/25/tip-upgrading-postgis-sfcgal/ | |
ALTER EXTENSION postgis UPDATE; | |
SELECT postgis_extensions_upgrade(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment