pgjdbc-ng icon indicating copy to clipboard operation
pgjdbc-ng copied to clipboard

Unable to create Array of ByteArrays for prepared statement

Open obabichevjb opened this issue 1 year ago • 0 comments

Version: 0.8.9

I have a table with the column of type bytea[]

I want to insert the value with a prepared statement into the table. To do that at one moment, I call something like this (Kotlin):

val statement: PGPreparedStatement = ...
val type = "bytea"
val array = arrayOf(byteArrayOf(0), byteArrayOf(1, 2, 3))
val argument = statement.connection.createArrayOf(type, array)

It works fine with the org.postgresql:postgresql:42.7.3, but fails with com.impossibl.pgjdbc-ng:pgjdbc-ng:0.8.9

The error occurred is the following:

com.impossibl.postgres.jdbc.PGSQLSimpleException: Error encoding array values
  at com.impossibl.postgres.jdbc.ErrorUtils.makeSQLException(ErrorUtils.java:151)
  at com.impossibl.postgres.jdbc.PGDirectConnection.createArrayOf(PGDirectConnection.java:1233)
  ...

obabichevjb avatar May 02 '24 09:05 obabichevjb