Our Django project running on an OSX instance is having an issue after a accidental upgrade with brew.
Previously, the Django system was running postgresql-9.5 with postgis-2.3 and worked with no issues.
However once brew installed postgresql version 10.5 and postgis 2.5 everything started to break.
After this update we receive the following error when trying to run a database query in Django:
django.db.utils.OperationalError: could not access file "$libdir/postgis-2.4": No such file or directory
When going into psql to try and get the extenstion to 2.4 by running:
ALTER EXTENSION postgis UPDATE TO "2.4.0";
We get the error:
ERROR: extension "postgis" has no update path from version "2.5.0" to version "2.4.0"
We have been unsuccessful in reinstalling postgresql 9.5 and postgis 2.3 with brew and are not sure where to turn next to try and get the development system running.
Looking for suggestions on how to either get the Django instance to look for extension 2.5 which I'm guessing now exist or to return the postgres system to it's former state on the mac through brew.
Django version 2.0.1 and psycopg2 version 2.7.3.2
UPDATE
Unfortunately the only solution that has worked so far was to follow the answer by n1000 on gis Stack Exchange: Which basically
Create a pg_dump of the data
pg_dump -h HOST_URL --user USER --password --column-inserts --data-only -T 'topology.topology' -t 'public.*' DATABASE_NAME_ON_THE_POSTGRES_SERVER -O -x > local.sql
Dropped the local database
Run the update script on psql
ALTER EXTENSION postgis UPDATE;
Restore the data from the pd_dump that was created earlier
psql -U postgres DATABASE < local.sql