You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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: