Skip to content
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

PostgreSQL empty array column returns a null Java value instead of an empty array. #1833

Closed
Jul13nT opened this issue Jul 11, 2024 · 1 comment
Labels
status: duplicate A duplicate of another issue

Comments

@Jul13nT
Copy link

Jul13nT commented Jul 11, 2024

I have an Entity with a field of type String[], mapped to a PostgreSQL database with a text[] column.

With Spring Data JDBC (Spring Boot 3.3.1), when using JdbcAggregateOperations.findAll API (or others like findOne) the result entity for this field is null when the column is empty.

I'm expecting the following results:

  • column has multiple values -> result is a String array with these values
  • column is null -> result is null
  • column is empty -> result is an empty String array.

The third case returns null instead of an empty array.

I have made a reproduction repo: https://github.com/Jul13nT/spring-data-jdbc-empty-array
You can run the CustomerRepositoryTest to see the problem. The first customer has two values, the second one has null value and the third one as well (but should be empty).

@Jul13nT
Copy link
Author

Jul13nT commented Jul 11, 2024

Oops sorry, I think this is the same case as #1826

@Jul13nT Jul13nT closed this as completed Jul 11, 2024
@schauder schauder added the status: duplicate A duplicate of another issue label Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

2 participants