postgresqlpostgispostgis-installation

missing Types for postgis after created new schema in Postgres


I have a Postgres database called db_1 and a schema s1

(Using PgAdmin)

  1. Then I installed postgis and postgis_topology.
CREATE EXTENSION IF NOT EXISTS postgis;
CREATE EXTENSION IF NOT EXISTS postgis_topology;

under s1, I can see 18 Types including the geography, geometry ...etc

  1. Then I update the parameter search_path from s1, s2, public
  2. Then I created another schema s2, but this time s2 has no type

  3. Run my flyway sql on Spring,

Caused by: org.postgresql.util.PSQLException: ERROR: type "geography" does not exist


Solution

  • Turns out it is not about how to install, but how to connect

    I am using Spring to connect to the pgsql, for example, I am connecting to schema s1 and the extension is installed on postgis.

    When I set the connection string to the following, then it works:

    ?currentSchema=s1,postgis