« Return to Thread: Query parameters limit in postgres jdbc driver?

Query parameters limit in postgres jdbc driver?

by olafos :: Rate this Message:

Reply to Author | View in Thread

Hi,

I'm using Toplink JPA with Postgresql JDBC driver in my application and I encountered the following problem. I'm creating a query with IN clause containing a couple of thousand of parameters. When the query is sent to the jdbc driver the following error occurs:

Local Exception Stack:
Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build 09d (12/06/2007))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: An I/O error occured while sending to the backend.
Error Code: 0
        ...
Caused by: org.postgresql.util.PSQLException: An I/O error occured while sending to the backend.
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:217)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:351)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:255)
        at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeSelect(DatabaseAccessor.java:726)
        at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:501)
        ... 40 more
Caused by: java.io.IOException: Tried to send an out-of-range integer as a 2-byte value: 40000
        at org.postgresql.core.PGStream.SendInteger2(PGStream.java:194)
        at org.postgresql.core.v3.QueryExecutorImpl.sendParse(QueryExecutorImpl.java:769)
        at org.postgresql.core.v3.QueryExecutorImpl.sendOneQuery(QueryExecutorImpl.java:1036)
        at org.postgresql.core.v3.QueryExecutorImpl.sendQuery(QueryExecutorImpl.java:643)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:189)
        ... 45 more

Seems like the driver is trying to send the number 40,000 (which is actually the number of query parameters) as a 2-byte integer. Is there any limit to the number of jdbc query parameters in postgresql?

Thanks,
Olaf Tomcak


 « Return to Thread: Query parameters limit in postgres jdbc driver?