Upgrade postgis in PostgreSQL2024-07-07

If you've ever upgraded your PostgreSQL database with postgis installed, you might encounter this error: ERROR: could not access file "$libdir/postgis-2.5": No such file or directory.

Solution

Check and upgrade the extensions in your newly upgraded PostgreSQL database.

--- check current installed extention
SELECT * 
FROM pg_extension;

--- check current available extension version
SELECT * FROM pg_available_extensions;

--- alter it to change the executable location. eg 3.3.4
ALTER EXTENSION postgis UPDATE TO '3.3.4';