Re: JDBC prepared statement: a 32767 limit of arguments number - Mailing list pgsql-jdbc

From David G. Johnston
Subject Re: JDBC prepared statement: a 32767 limit of arguments number
Date
Msg-id CAKFQuwaJUe-fpLRiY3hNrMeH7A1AOu8coOZ+Bfh6cMJRBuhSLw@mail.gmail.com
Whole thread Raw
In response to Re: JDBC prepared statement: a 32767 limit of arguments number  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: JDBC prepared statement: a 32767 limit of arguments number  (Vladimir Sitnikov <sitnikov.vladimir@gmail.com>)
List pgsql-jdbc
On Wed, Mar 9, 2022 at 1:09 PM Vladislav Malyshkin <mal@gromco.com> wrote:
On 09/03/2022 14.55, David G. Johnston wrote:
>PostgreSQL would expect that you would use the COPY API in this kind of situation.

Yes, one can use copyIn  method but data transformation to InputStream loses data type information of the programming language. The beauty of PreparedStatement is that the methods like setLong, setString preserve programming language data types

I don't understand why this matters.  As soon as the data hits the database table the programming language data types no longer matter as the data types of the columns become official.  You do have to deal with converting programming data types to their textual representations for the COPY command but the driver should be capable of helping with that - especially since I'm pretty sure it already has to do that anyway for those various setXXX methods.  The gain in server parsing and bind savings alone should make the client-side effort worthwhile.

David J.

pgsql-jdbc by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: JDBC prepared statement: a 32767 limit of arguments number
Next
From: Vladimir Sitnikov
Date:
Subject: Re: JDBC prepared statement: a 32767 limit of arguments number