My SQL commands have issues finding objects from the public schema (which is in the default DB search_path) when specifying the currentSchema parameter in the DB connection URL.
How could this be fixed?
The long story:
- I have an application schema
app1. - The DB has the Postgis extension installed in the
publicschema (and we want to keep it there). The DB
search_pathis configured like this:ALTER DATABASE tst SET search_path = "$user", publicWhen connecting to the DB without specifying current schema in URL, the default schema is public and so it finds all the geo functions and objects. But I have to specify the
app1schema prefix when addressing objects fromapp1, e.g.:select st_asgeojson(geometry,15,4) from app1.shapes limit 5This is not convenient. So I added "app1" as a current schema parameter to the connection URL like this:
jdbc:postgresql://localhost:5432/tst?currentSchema=app1Now, when I connect to the DB, I don't have to specify the app1 prefix when addressing objects from app1 schema. However, requests that involve Postgis objects don't work anymore and fail with:
ERROR: function st_asgeojson(public.geometry, integer) does not exist
My understanding is that it should search for the objects in the search_path and find them in the public schema but it doesn't happen for some reason.
I've tried specifying search path on a user level as well but it still didn't work.