Re: [JDBC] ArrayIndexOutOfBoundsException from ByteConverter.int8when resolving generated keys - Mailing list pgsql-jdbc

From Dave Cramer
Subject Re: [JDBC] ArrayIndexOutOfBoundsException from ByteConverter.int8when resolving generated keys
Date
Msg-id CADK3HHJh8CWn+cW6FcZUbM7O4KgQ1Q4hybzaR_UMkKtT+fyr-Q@mail.gmail.com
Whole thread Raw
In response to Re: [JDBC] ArrayIndexOutOfBoundsException from ByteConverter.int8when resolving generated keys  (Vladimir Sitnikov <sitnikov.vladimir@gmail.com>)
Responses Re: [JDBC] ArrayIndexOutOfBoundsException from ByteConverter.int8when resolving generated keys  (Erko Hansar <erko.hansar@gmail.com>)
Re: ArrayIndexOutOfBoundsException from ByteConverter.int8when resolving generated keys  (Erko Hansar <erko.hansar@gmail.com>)
List pgsql-jdbc

On 10 May 2017 at 16:35, Vladimir Sitnikov <sitnikov.vladimir@gmail.com> wrote:
Here's the case:
1) Execute "insert" via non-batch multiple times. This causes pgjdbc to server-prepare the insert and use binary transfer for the generated keys.
Note: so far so good, it is perfectly fine.
2) Execute the same SQL via batch API. Here things break. Batch-insert wants generated keys in text format (there's QUERY_NO_BINARY_TRANSFER flag exactly for that case), and it does ask backend to send the data in text format. However, query metadata at pgjdbc side specify that "output columns are in binary format", thus generated keys resultset tries to access columns as binary and fails.

I would have thought this would have been solved by now :( 

So possible workarounds are:
WA1) Add special marker (that is a comment) to batch SQL. That will make sure batch-insert uses its own statement.
This is ugly 
WA2) mark INT8 as text-only. It is something like binaryTransferDisable=INT8 connection property
This is probably preferable 




pgsql-jdbc by date:

Previous
From: Vladimir Sitnikov
Date:
Subject: Re: [JDBC] ArrayIndexOutOfBoundsException from ByteConverter.int8when resolving generated keys
Next
From: Erko Hansar
Date:
Subject: Re: [JDBC] ArrayIndexOutOfBoundsException from ByteConverter.int8when resolving generated keys