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 copyInmethod but data transformation to InputStreamloses 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.