Re: [JDBC] ArrayIndexOutOfBoundsException from ByteConverter.int8when resolving generated keys

Поиск
Список
Период
Сортировка
От Dave Cramer
Тема Re: [JDBC] ArrayIndexOutOfBoundsException from ByteConverter.int8when resolving generated keys
Дата
Msg-id CADK3HHJh8CWn+cW6FcZUbM7O4KgQ1Q4hybzaR_UMkKtT+fyr-Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [JDBC] ArrayIndexOutOfBoundsException from ByteConverter.int8when resolving generated keys  (Vladimir Sitnikov <sitnikov.vladimir@gmail.com>)
Ответы 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>)
Список 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 по дате отправления:

Предыдущее
От: Vladimir Sitnikov
Дата:
Сообщение: Re: [JDBC] ArrayIndexOutOfBoundsException from ByteConverter.int8when resolving generated keys
Следующее
От: Erko Hansar
Дата:
Сообщение: Re: [JDBC] ArrayIndexOutOfBoundsException from ByteConverter.int8when resolving generated keys