Java with MyBatis postgreql postgis query - type geometry does not exist 错误

Java with MyBatis postgreql postgis query - type geometry does not exist error

我是运行 spring boot 2 和myBatis with postgresql。 我在我的数据库中安装了 postgis 扩展。 当 运行 从我的应用程序查询时 - 我收到错误:

PSQLException: error: type "geometry" does not exist.

运行 PGAdmin 中的相同查询 - 我得到了结果,这意味着扩展安装成功。 当 运行 来自 Java 的查询没有几何参数时 - 也成功。 这是mybatis的查询:

"<select id="selectMyFilters" parameterType="map" resultType="FilterOptions">
select ${column} as value,
from myFilters where 
${column} is not null 
<if test="geometry != null">
and (
<![CDATA]
ST_WITHIN (myGeo :: geometry, ST_SETSRID(ST_GeomFromGeoJSON('${geometry}'),4326))
GROUP BY ${column};
</select>"

MyGeo 列也在数据库中定义为 GEOGRAPHY(POINTZ,4326)

我已经花了2天了,但找不到问题。

有人可以帮忙吗?

将 public 方案添加到搜索路径,(除了您从中获取数据的方案之外)因为 gis 安装在 public 方案中