| From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
|---|---|
| To: | Vladislav Malyshkin <mal(at)gromco(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-09 20:18:37 |
| Message-ID: | CAKFQuwaJUe-fpLRiY3hNrMeH7A1AOu8coOZ+Bfh6cMJRBuhSLw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-jdbc |
On Wed, Mar 9, 2022 at 1:09 PM Vladislav Malyshkin <mal(at)gromco(dot)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
> <https://jdbc.postgresql.org/documentation/publicapi/org/postgresql/copy/CopyManager.html#copyIn-java.lang.String-org.postgresql.util.ByteStreamWriter->
> method but data transformation to InputStream
> <https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html?is-external=true> 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.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Vladimir Sitnikov | 2022-03-10 09:08:26 | Re: JDBC prepared statement: a 32767 limit of arguments number |
| Previous Message | Vladislav Malyshkin | 2022-03-09 20:09:47 | Re: JDBC prepared statement: a 32767 limit of arguments number |