Upgrade PostgreSQL 10 to 11 with PostGIS 2.5

After a brew upgrade && brew cleanup I’ve seen that the postgresql server isn’t starting because the data folder has the old version, so I’ve tried with

brew postgresql-upgrade-database

and upgrade fails with:

pg_dump: [archiver (db)] query failed: ERROR:  could not access file "$libdir/postgis-2.4": No such file or directory
pg_dump: [archiver (db)] query was: SELECT pg_catalog.pg_get_viewdef('18047'::pg_catalog.oid) AS viewdef

I’ve tried to create a fake symlink like this:

ln -s /usr/local/Cellar/postgis/2.5.0_1/lib/postgresql/postgis-2.5.so /usr/local/lib/postgresql/postgis-2.4.so

however it still complains it’s not finding the 2.4 version, any ideas?

1 Like

Are you sure that would end up as the same file? "$libdir/postgis-2.4" seems different from postgis-2.4.so to me.

Well there is no postgis-2.5 anywhere after installing it so I imagined that’s what it was searching for

You could try doing brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/96eca3129729121875da2324a5b45390743f06d0/Formula/postgis.rb to install a 2.4.x version temporarily.

Did that, however after installing it

brew info postgis
postgis: stable 2.5.1 (bottled), HEAD
Adds support for geographic objects to PostgreSQL
/usr/local/Cellar/postgis/2.4.4_1 (248 files, 101.2MB) *
  Poured from bottle on 2019-01-30 at 19:39:55
/usr/local/Cellar/postgis/2.5.1 (263 files, 26.6MB)
  Poured from bottle on 2018-12-30 at 21:46:38

but I’m still getting that error, maybe because the temporary PG10 install to convert to 11 doesn’t have that?

I have the same issue, though I also see PostGIS 2.4.4_1 in the Cellar. Isn’t it because it is looking for 2.4?
pg_dump: [archiver (db)] query failed: ERROR: could not access file “$libdir/postgis-2.4”: No such file or directory
How can I bring Postgis-2.4 back? Or is there any work around it?

Just make symbolic links to postgis-2.5.so named as postgis-2.4.so at /usr/local/lib/postgresql/

That worked for me

Hmm tried creating that symlink, and I’m still getting the error. @redsoundcircle did that resolve your issue, or did you fix it another way?

Thanks for asking. I am very confused now and not sure what is the problem. Here is another post that I have created to ask for help. So far not luck.
About the symbolic link, I don’t know how could I make that, or if that would solve my issue.
Please, help and elaborate more, as I desperately need my data and I am hopeful still is somewhere on my laptop.

well, so ln -s (as in the OP) is how you create a symbolic link. but as I said, creating the link that @danadn mentioned (at least as I understood the instruction) didn’t work for me, so I’m not sure I can help. @danadn could you be somewhat more specific? it’s possible I’ve misunderstood.

So, I just tried the ln -s and it didn’t work. Still I get

pg_dump: [archiver (db)] query failed: ERROR:  could not access file "$libdir/postgis-2.4": No such file or directory

Though, I should say, I have PostGIS 2.4.4_1, which of course, I changed the address to that too.