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

BasicRelationalConverter converts enum arrays to null #1593

Closed
jurriaan opened this issue Aug 21, 2023 · 2 comments
Closed

BasicRelationalConverter converts enum arrays to null #1593

jurriaan opened this issue Aug 21, 2023 · 2 comments
Assignees
Labels
type: regression A regression from a previous release

Comments

@jurriaan
Copy link

Opening a new ticket since I cannot reopen #1544 and the issue seems to also be present in the latest 3.0.x releases.

When updating from Spring v3.0.x to v3.1.1 we get the following database error when trying to persist an empty list of an enum type (kotlin emptyList()) to an array column in PostgreSQL:

null value in column "foo" of relation "bar" violates not-null constraint

I've created a small example project with a test that can reproduce the issue. It shows that it's not possible to persist arrays of enums, whether they are empty or not on spring-boot 3.0.9/3.1.x, but can on earlier spring boot versions:

https://github.com/jurriaan/issue-1544

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 21, 2023
@mp911de mp911de changed the title Persisting lists of enums in 3.0.8 / 3.1.x results in null value being inserted. BasicRelationalConverter converts enum arrays to null Aug 23, 2023
@mp911de mp911de added type: regression A regression from a previous release and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 23, 2023
@mp911de mp911de added this to the 3.0.10 (2022.0.10) milestone Aug 23, 2023
mp911de added a commit that referenced this issue Aug 23, 2023
We now correctly convert array write values. Previously, enum arrays were converted to null as these fell through the entity conversion.

Closes #1593
mp911de added a commit that referenced this issue Aug 23, 2023
We now correctly convert array write values. Previously, enum arrays were converted to null as these fell through the entity conversion.

Closes #1593
@mp911de
Copy link
Member

mp911de commented Aug 23, 2023

Thanks for the reproducer. It contained the missing bit of retaining the enum type which has led to conversion into the null value.

The fix is now deployed as part of the latest 3.0.x, 3.1.x and 3.2.0 snapshots if you want to verify that the fix is working for you. Make sure to upgrade both, R2DBC and Relational artifacts.

@mp911de mp911de self-assigned this Aug 23, 2023
@jurriaan
Copy link
Author

Thanks a lot for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: regression A regression from a previous release
Projects
None yet
Development

No branches or pull requests

3 participants