Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
LEDfan opened this issue Aug 24, 2021 · 0 comments
Closed

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

LEDfan opened this issue Aug 24, 2021 · 0 comments
Labels
type: enhancement A general enhancement

Comments

@LEDfan
Copy link

LEDfan commented Aug 24, 2021

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!

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 24, 2021
schauder added a commit that referenced this issue Aug 27, 2021
Postgres requires the non standard type "FLOAT8" for "DOUBLE".
This is accomplished by making the conversion dependent on the dialect.

This required a new JdbcDialect interface in order to keep the JDBC annotation out of the relational module.

Closes #1033
@schauder schauder removed the status: waiting-for-triage An issue we've not yet triaged label Sep 7, 2021
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 7, 2021
@schauder schauder added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 7, 2021
schauder added a commit that referenced this issue Sep 13, 2021
Postgres requires the non standard type "FLOAT8" for "DOUBLE".
This is accomplished by making the conversion dependent on the dialect.

This required a new JdbcDialect interface in order to keep the JDBC annotation out of the relational module.

Closes #1033
mp911de pushed a commit that referenced this issue Sep 30, 2021
Postgres requires the non standard type "FLOAT8" for "DOUBLE".
This is accomplished by making the conversion dependent on the dialect.

This required a new JdbcDialect interface in order to keep the JDBC annotation out of the relational module.

Closes #1033
mp911de added a commit that referenced this issue Sep 30, 2021
Encapsulate array support in JdbcArrayColumns.

See #1033
Original pull request: #1037.
@mp911de mp911de added this to the 2.3 RC1 (2021.1.0) milestone Sep 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants