Skip to content

SqlBinaryValue behaviour in postgre #34786

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

Open
ArR4e opened this issue Apr 21, 2025 · 0 comments
Open

SqlBinaryValue behaviour in postgre #34786

ArR4e opened this issue Apr 21, 2025 · 0 comments
Labels
status: waiting-for-triage An issue we've not yet triaged or decided on

Comments

@ArR4e
Copy link

ArR4e commented Apr 21, 2025

I noticed a difference in behaviour when using recently added SqlBinaryValue instead of SqlLobValue:
array is of type byte[]
new SqlParameterValue(Types.BLOB, new SqlLobValue(array) used to work with postgres, but
new SqlParameterValue(Types.BLOB, new SqlBinaryValue(array) does not.
In fact, new SqlParameterValue(Types.ARRAY, new SqlBinaryValue(array) should be used instead.
Combination of BLOB and byte[] value leads to SqlLobValue calling setBytes on PreparedStatement (sets bytea value in postgre driver).
Combination of BLOB and byte[] value leads to SqlBinaryValue wrap bytes in input stream and call setBlob (postgre driver will use large object API and set int8 (id of LOB) value instead of bytea, leading to BadSQLGrammarException)

I am not sure whether change of semantics and wrapping of bytes in InputStream and delegating to setBlob is intended.
If it is, I think it is worthy of a mention in release notes, as migrating from SqlLobValue also requires changing SqlType from BLOB to ARRAY.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Apr 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged or decided on
Projects
None yet
Development

No branches or pull requests

2 participants