impossibl / pgjdbc-ng

A new JDBC driver for PostgreSQL aimed at supporting the advanced features of JDBC and Postgres
https://impossibl.github.io/pgjdbc-ng
Other
596 stars 108 forks source link

Unable to create Array of ByteArrays for prepared statement #600

Open obabichevjb opened 2 months ago

obabichevjb commented 2 months ago

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)
  ...