PostgreSQL - max number of parameters in "IN" clause?

postgresql

Solution

This is not really an answer to the present question, however it might help others too.

At least I can tell there is a technical limit of 32767 values (=Short.MAX_VALUE) passable to the PostgreSQL backend, using Posgresql's JDBC driver 9.1.

This is a test of "delete from x where id in (... 100k values...)" with the postgresql jdbc driver:

Caused by: java.io.IOException: Tried to send an out-of-range integer as a 2-byte value: 100000
    at org.postgresql.core.PGStream.SendInteger2(PGStream.java:201)

Problem

In Postgres, you can specify an IN clause, like this: ``` SELECT * FROM user WHERE id IN (1000, 1001, 1002) ``` Does anyone know what's the maximum number of parameters you can pass into IN?

Original source