Skip to content

Support float[] for Postgres #1046

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
schauder opened this issue Sep 13, 2021 · 1 comment
Closed

Support float[] for Postgres #1046

schauder opened this issue Sep 13, 2021 · 1 comment
Assignees

Comments

@schauder
Copy link
Contributor

schauder commented Sep 13, 2021

As pointed out in #1037 (comment) float arrays don't work properly with Postgres.

This is actually a two part problem.
One is that writing doesn't work because Postgres requires a special type representation, when writing arrays of floats.
That issue will be resolved by 9f0ada5
The other problem is that loading that array again results in a List of double instead of float.

@schauder schauder self-assigned this Sep 13, 2021
@schauder schauder reopened this Sep 13, 2021
schauder added a commit that referenced this issue Sep 13, 2021
…rays.

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

Original pull request #1037
See #1046
mp911de pushed a commit that referenced this issue Sep 30, 2021
…rays.

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

Original pull request #1037
See #1046
mp911de pushed a commit that referenced this issue Sep 30, 2021
…rays.

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

Original pull request #1037
See #1046
@ctailor2
Copy link
Contributor

When defining the column in postgres, if float4[] is used for the data type instead of float[] or float8[], the postgres jdbc driver returns the expected List<Float> rather than List<Double>. See the jdbc driver array support documentation for details on the postgres data type to java type mapping.

While this works natively for postgres jdbc driver, other stores may not have a data type mapping to java Float (i.e. hsql), so it would still be better to try to convert array elements to match the expected entity type, if possible.

schauder added a commit that referenced this issue Jan 31, 2022
schauder added a commit that referenced this issue Jan 31, 2022
See #1046
Original pull request #1144
schauder pushed a commit that referenced this issue Feb 15, 2022
This is achieved by passing the full availabe type information of the conversion target to the conversion service.

This broke a test which wasn't functional in the first place which becomes obvious when adding the proper assertion.

Closes #1046
Original pull request #1144
schauder added a commit that referenced this issue Feb 15, 2022
schauder added a commit that referenced this issue Feb 15, 2022
See #1046
Original pull request #1144
@ctailor2 ctailor2 self-assigned this Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants