Spring-boot vs Postgres vs Cockroach-> fastpath函数lo_creat是未知的

问题描述

在我的Spring-boot应用程序中将Postgres更改为Cockroach之后,我开始遇到此问题:

The fastpath function lo_creat is unkNown.

然后登录

org.postgresql.util.PsqlException: The fastpath function lo_creat is unkNown.
    at org.postgresql.fastpath.Fastpath.getID(Fastpath.java:297) ~[postgresql-42.2.14.jar!/:42.2.14]
    at org.postgresql.fastpath.Fastpath.fastpath(Fastpath.java:146) ~[postgresql-42.2.14.jar!/:42.2.14]
    at org.postgresql.fastpath.Fastpath.getInteger(Fastpath.java:158) ~[postgresql-42.2.14.jar!/:42.2.14]
    at org.postgresql.fastpath.Fastpath.getoID(Fastpath.java:209) ~[postgresql-42.2.14.jar!/:42.2.14]
    at org.postgresql.largeobject.LargeObjectManager.createLO(LargeObjectManager.java:295) ~[postgresql-42.2.14.jar!/:42.2.14]
    at org.postgresql.largeobject.LargeObjectManager.createLO(LargeObjectManager.java:278) ~[postgresql-42.2.14.jar!/:42.2.14]
    at org.postgresql.jdbc.PgPreparedStatement.setClob(PgPreparedStatement.java:1215) ~[postgresql-42.2.14.jar!/:42.2.14]
    at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.setClob(HikariProxyPreparedStatement.java) ~[HikariCP-3.4.5.jar!/:na]

  

在spring-boot中,有一个简单的解决方法吗?由于它似乎不适用于蟑螂。

它似乎与休眠和DB文本字段有关。

解决方法

Spring Boot应该可以让您配置数据库方言。您可以尝试设置以下内容吗?

spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.CockroachDB201Dialect

CockroachDB语言应避免使用这些LOB函数。

,

您不敢相信CockroachDB是PostgreSQL兼容的。

但是似乎它们的兼容性并没有扩展到大对象,因此您不应该调用org.postgresql.largeobject.LargeObjectManager