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

From: Vladislav Malyshkin <mal(at)gromco(dot)com>
To: Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: 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-10 16:55:39
Message-ID: 61f81ae4-d1fd-9331-3b48-b957ff5fc741@gromco.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">On 10/03/2022 04.08, Vladimir Sitnikov
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAB=Je-G7Xa9KR_sMYuO7TKOURjT7wQ7rdbn-k0trSebMNaaYhg(at)mail(dot)gmail(dot)com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr"><br>
<div>Have you tried PreparedStatement#addBatch + #executeBatch
APIs and reWriteBatchedInserts=true connection option?</div>
<div>It might yield the expected speedup without resorting to
PG-specific APIs and syntax like COPY.</div>
<br>
</div>
</blockquote>
<br>
Yes, I tried addBatch + executeBatch. It was very inconvenient in my
specific case. I used all over the place postgresql extension<br>
<br>
  insert into table(c1, c2, c3, ...) values (....) RETURNING *<br>
<br>
this way I can "get back" the data inserted. The PG extension
INSERT/UPDATE/DELETE ... RETURNING *<br>
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.<br>
The  #executeBatch returns the number of rows changed, not the data
as with the RETURNING *<br>
<br>
Vladislav <font size="+1"><br>
</font>
</body>
</html>

Attachment Content-Type Size
unknown_filename text/html 1.4 KB

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2022-03-11 12:09:12 Re: JDBC prepared statement: a 32767 limit of arguments number
Previous Message Andrew Dunstan 2022-03-10 13:09:00 Re: JDBC prepared statement: a 32767 limit of arguments number