I'm working on OSX and have postgres installed via Homebrew. I've just upgraded Postgres from v11 to v13. Now I've tried updating the database files with:
brew postgresql-upgrade-database
This fails and looking at the logs, the error is:
pg_dump: error: query failed: ERROR: could not access file "$libdir/postgis-2.5": No such file or directory
If I do brew info postgis then I see:
% brew info postgis
postgis: stable 3.0.2 (bottled), HEAD
Adds support for geographic objects to PostgreSQL
https://postgis.net/
/usr/local/Cellar/postgis/3.0.2_1 (435 files, 29.7MB) *
Poured from bottle on 2020-11-12 at 23:15:12
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/postgis.rb
License: GPL-2.0-or-later
==> Dependencies
Build: gpp ✘, pkg-config ✔
Required: gdal ✔, geos ✔, json-c ✔, pcre ✔, postgresql ✔, proj ✔, protobuf-c ✔, sfcgal ✔
==> Options
--HEAD
Install HEAD version
==> Analytics
install: 11,064 (30 days), 26,959 (90 days), 80,033 (365 days)
install-on-request: 10,946 (30 days), 26,628 (90 days), 78,351 (365 days)
build-error: 0 (30 days)
So I guess Postgis 3.0.2 was installed as part of the upgrade process and pg_dump (which is needed for the database file upgrade) can't find Postgis 2.5.
What should I do? I guess I could reinstall Postgis 2.5 to $libdir temporarily - but how?
pg_config --pkglibdir reveals that $libdir is /usr/local/lib/postgresql. If I list the files in that directory, I can see it contains postgis-3.so, but not postgis-2.5.so.
NB: I also can't currently access postgres with psql - I see the dreaded psql: error: could not connect to server: could not connect to server: No such file or directory. However, brew services list tells me that postgresql is running.