Archive for May, 2025

Moved to Postgres 17

Friday, May 9th, 2025

PostgreSQL.jpg

This morning I noticed that not only was Postgres 17 out, they had released 17.5. I try to keep up to the latest major version, and I seem to be slipping in recent days, and I needed to correct that this morning. 🙂

So based on the steps to move to 16, start by saving everything in all the databases:

  $ pg_dumpall > dump.sql
  $ brew services stop postgresql@16

Now we can wipe out the old install and it's data:

  $ brew uninstall postgresql@16
  $ rm -rf /opt/homebrew/var/postgresql@16

Now we install the new version, start it, and load back up the data:

  $ brew install postgresql@17
  $ brew services start postgresql@17
  $ brew link postgresql@17
  $ psql -d postgres -f dump.sql
  $ psql -l

At this point, it's all loaded up and you can ditch the dump.sql file, as it's no longer needed, and the new version is active:

  $ psql --version
  psql (PostgreSQL) 17.5 (Homebrew)

Excellent. 🙂

As a minor point, I fired up my Clojure code, and it hit the database perfectly. The dump and load worked, the JDBC calls worked, and everything was great.