Skip to content

SQL type used in array construction depends on Dialect. #1037

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
wants to merge 4 commits into from

Conversation

schauder
Copy link
Contributor

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 requested a review from gregturn August 27, 2021 09:30
@LEDfan
Copy link

LEDfan commented Sep 13, 2021

Hi @schauder

Thanks for taking care of this issue! I tested this branch in my project and it works for double[]. However, in the meantime I also started using float[] and this still gives an error. See this stacktrace:

Caused by: org.postgresql.util.PSQLException: Unable to find server array type for provided name REAL.
	at org.postgresql.jdbc.PgConnection.createArrayOf(PgConnection.java:1379) ~[postgresql-42.2.23.jar:42.2.23]
	at org.postgresql.jdbc.PgConnection.createArrayOf(PgConnection.java:1399) ~[postgresql-42.2.23.jar:42.2.23]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
	at org.springframework.jdbc.core.JdbcTemplate$CloseSuppressingInvocationHandler.invoke(JdbcTemplate.java:1614) ~[spring-jdbc-5.3.9.jar:5.3.9]
	at com.sun.proxy.$Proxy45.createArrayOf(Unknown Source) ~[na:na]
	at org.springframework.data.jdbc.core.convert.DefaultJdbcTypeFactory.lambda$createArray$1(DefaultJdbcTypeFactory.java:73) ~[spring-data-jdbc-2.3.0-1033-double-array-SNAPSHOT.jar:2.3.0-1033-double-array-SNAPSHOT]
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:334) ~[spring-jdbc-5.3.9.jar:5.3.9]
	... 61 common frames omitted

Thanks again.

schauder added a commit that referenced this pull request Sep 13, 2021
…rays.

Note that there is a separate problem with loading arrays of floats.

Original pull request #1037
See #1046
@schauder schauder force-pushed the issue/1033-double-array branch from 0abdff9 to 9f0ada5 Compare September 13, 2021 11:11
@schauder schauder requested a review from mp911de September 28, 2021 13:12
schauder and others added 4 commits September 30, 2021 12:06
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
…rays.

Note that there is a separate problem with loading arrays of floats.

Original pull request #1037
See #1046
Encapsulate array support in JdbcArrayColumns.
@mp911de mp911de force-pushed the issue/1033-double-array branch from 9f0ada5 to c2ea580 Compare September 30, 2021 10:06
mp911de pushed a commit that referenced this pull request 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
Original pull request: #1037.
mp911de pushed a commit that referenced this pull request Sep 30, 2021
…rays.

Note that there is a separate problem with loading arrays of floats.

Original pull request #1037
See #1046
mp911de added a commit that referenced this pull request Sep 30, 2021
Encapsulate array support in JdbcArrayColumns.

See #1033
Original pull request: #1037.
@mp911de mp911de added the type: enhancement A general enhancement label Sep 30, 2021
@mp911de mp911de added this to the 2.3 RC1 (2021.1.0) milestone Sep 30, 2021
@mp911de
Copy link
Member

mp911de commented Sep 30, 2021

That's merged and polished now.

@mp911de mp911de closed this Sep 30, 2021
@mp911de mp911de deleted the issue/1033-double-array branch September 30, 2021 12:36
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 this pull request may close these issues.

PostgreSQL: Unable to find server array type for provided name DOUBLE
3 participants