SqlBinaryValue behaviour in postgre #34786
Labels
in: data
Issues in data modules (jdbc, orm, oxm, tx)
status: waiting-for-triage
An issue we've not yet triaged or decided on
Uh oh!
There was an error while loading. Please reload this page.
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, butnew 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.
The text was updated successfully, but these errors were encountered: