Re: ArrayIndexOutOfBoundsException from ByteConverter.int8 when resolving generated keys

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>
Cc: Erko Hansar <erko(dot)hansar(at)gmail(dot)com>, List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: ArrayIndexOutOfBoundsException from ByteConverter.int8 when resolving generated keys
Date: 2017-05-11 12:36:29
Message-ID: CADK3HHJh8CWn+cW6FcZUbM7O4KgQ1Q4hybzaR_UMkKtT+fyr-Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On 10 May 2017 at 16:35, Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)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

Dave Cramer

davec(at)postgresintl(dot)com
www.postgresintl.com

>
>>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Erko Hansar 2017-05-11 12:42:50 Re: ArrayIndexOutOfBoundsException from ByteConverter.int8 when resolving generated keys
Previous Message Vladimir Sitnikov 2017-05-10 20:35:14 Re: ArrayIndexOutOfBoundsException from ByteConverter.int8 when resolving generated keys