Skip to content

PostgreSQL: Unable to find server array type for provided name DOUBLE #1033

Closed
@LEDfan

Description

@LEDfan

Hi all

I have an issue with Spring Data JDBC when trying to insert an entity which contains the Java type double[]. The corresponding table contains a PostgreSQL type double precision[]. When inserting such an entity, I get this error:

Caused by: org.postgresql.util.PSQLException: Unable to find server array type for provided name DOUBLE.

I created a repo containing a MWE and the full stack trace: https://github.com/LEDfan/spring-data-jdbc-double-array .

Note that this works:

        jdbcTemplate.update("INSERT INTO myentity (id, \"values\") VALUES (?, ?)", entity.getId(), entity.getValues());

I also tried using List<Double> (when advised on Gitter), but this causes the same error.
It seems that org.springframework.data.jdbc.support.JdbcUtil is used in the Spring code to convert the Double class to the text DOUBLE, however such a type is not supported by postgresql. The types supported are listed here: https://github.com/MSGoodman/pgjdbc/blob/master/pgjdbc/src/main/java/org/postgresql/jdbc/TypeInfoCache.java#L72

Let me know if you need more information and thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions