Thread: [pgjdbc/pgjdbc] 6c0c5d: fix: support queries with up to 65535 (inclusive) ...

[pgjdbc/pgjdbc] 6c0c5d: fix: support queries with up to 65535 (inclusive) ...

From
Vladimir Sitnikov
Date:
  Branch: refs/heads/master
  Home:   https://github.com/pgjdbc/pgjdbc
  Commit: 6c0c5da4075960e1dffa91480fb8b3a4932f8e1b
      https://github.com/pgjdbc/pgjdbc/commit/6c0c5da4075960e1dffa91480fb8b3a4932f8e1b
  Author: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
  Date:   2022-06-01 (Wed, 01 Jun 2022)

  Changed paths:
    M CHANGELOG.md
    M pgjdbc/src/main/java/org/postgresql/core/PGStream.java
    M pgjdbc/src/main/java/org/postgresql/jdbc/PgPreparedStatement.java
    M pgjdbc/src/test/java/org/postgresql/test/jdbc2/BatchedInsertReWriteEnabledTest.java
    A pgjdbc/src/test/java/org/postgresql/test/jdbc42/PreparedStatement64KBindsTest.java

  Log Message:
  -----------
  fix: support queries with up to 65535 (inclusive) parameters

Previously the execution failed with "Tried to send an out-of-range integer as a 2-byte value"
when the user attempted executing a query with more than 32767 parameters.

Technically speaking, the wire protocol limit is 2-byte-unsigned-int,
so we should support 65535 parameters.

In practice, simple mode (preferQueryMode=simple) allows executing queries
with an arbitrary number of parameters, however, that escape hatch is not recommended
as it still has limits on the SQL length, and it would likely be slow.

fixes #1311