Spring-boot vs Postgres vs Cockroach -> The fastpath function lo_creat is unknown

428 views Asked by At

After changing out Postgres to Cockroach in my Spring-boot application I begin to get this issue:

The fastpath function lo_creat is unknown.

Then log:

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]

  

Is there a easy workaround for this in spring-boot? As it doesn't seem to be available for cockroach.

It seems to be related to hibernate and DB text fields.

2

There are 2 answers

0
rafiss On BEST ANSWER

Spring Boot should let you configure the DB dialect. Can you try setting the following:

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

The CockroachDB dialect should avoid using these LOB functions.

0
Laurenz Albe On

You fell for the claim that CockroachDB is PostgreSQL compatible.

But it seems that their compatibility does not extend to large objects, so you shouldn't invoke org.postgresql.largeobject.LargeObjectManager.