Search code examples
postgresqlhomebrewpostgis

postgresql `syntax error at or near "SUPPORT"` on updating postgis extension


This is a local setup on macOS with homebrew installed postgresql (12.1) and postgis (3.0.0).

I am getting this error in some java integration test:

Caused by: org.postgresql.util.PSQLException: ERROR: could not access file "$libdir/postgis-2.5": No such file or directory

and therefore tried to update the extension which caused another error:

# ALTER EXTENSION postgis UPDATE;
ERROR:  syntax error at or near "SUPPORT"

I couldn't find anything about this particular error message.


Solution

  • After trying some downgrades of postgresql and postgit, I asked in irc.freenode.net#postgis and was told to check my postgresql version (psql --version or SELECT version(); also shown on psql startup) and lo and behold the server version was still 11.5 while the client was 12.1.

    Turned out I didn't upgrade the database and restart the homebrew managed postgresql service after the last brew upgrade. The following steps got me to the 12.1 version of the server as well:

    $ brew services stop postgresql
    $ brew postgresql-upgrade-database
    $ brew services start postgresql
    

    Which allowed me to update the postgis extension successfully afterwards:

    ALTER EXTENSION postgis UPDATE;