Re: JDBC prepared statement: a 32767 limit of arguments number

From: Dave Cramer <davecramer(at)postgres(dot)rocks>
To: Vladislav Malyshkin <mal(at)gromco(dot)com>
Cc: Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-jdbc(at)lists(dot)postgresql(dot)org" <pgsql-jdbc(at)lists(dot)postgresql(dot)org>
Subject: Re: JDBC prepared statement: a 32767 limit of arguments number
Date: 2022-03-11 12:09:12
Message-ID: CADK3HHK6fPCYWD3YqxWk0jPckc0OHFziAoDJRRYMargKnFa41w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Fri, 11 Mar 2022 at 06:59, Vladislav Malyshkin <mal(at)gromco(dot)com> wrote:

> On 10/03/2022 04.08, Vladimir Sitnikov wrote:
>
>
> Have you tried PreparedStatement#addBatch + #executeBatch APIs and
> reWriteBatchedInserts=true connection option?
> It might yield the expected speedup without resorting to PG-specific APIs
> and syntax like COPY.
>
>
> Yes, I tried addBatch + executeBatch. It was very inconvenient in my
> specific case. I used all over the place postgresql extension
>
> insert into table(c1, c2, c3, ...) values (....) RETURNING *
>
> this way I can "get back" the data inserted. The PG extension
> INSERT/UPDATE/DELETE ... RETURNING *
> was so convenient to: 1. check the data, 2. autoincrements, 3. Return
> updated data, etc, that I started to use in with almost all
> insert/update/delete.
> The #executeBatch returns the number of rows changed, not the data as
> with the RETURNING *
>

Well using copy or any other mechanism such as an array isn't going to
provide you with the data returned.

If that is the requirement then there is little the driver can do as this
is a protocol limitation.

Regards,

Dave

>
> Vladislav
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Sehrope Sarkuni 2022-03-11 13:46:41 Re: JDBC prepared statement: a 32767 limit of arguments number
Previous Message Vladislav Malyshkin 2022-03-10 16:55:39 Re: JDBC prepared statement: a 32767 limit of arguments number