Updated on 2025-09-04 GMT+08:00

Typical Issues

  1. Symptom: The following exception occurs when fetchSize is set to Integer.MIN_VALUE in Statement and PreparedStatement:
    org.postgresql.util.PSQLException: Fetch size must be a value greater to or equal to 0.
        at org.postgresql.jdbc.PgStatement.setFetchSize(PgStatement.java:1623)

    Cause: The JDBC connection parameter enableStreamingQuery is not set to true.

  2. Symptom: The following exception occurs when the execute, executeQuery, and executeUpdate methods of Statement and PreparedStatement are called to query, insert, and update data:
    org.postgresql.util.PSQLException: Streaming query statement is still active. No statements may be issued when any streaming result sets are open and in use on a given connection. Ensure that you have called .close() on any active streaming statement sets before attempting more queries.
        at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:492)
        at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:210)
        at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:147)

    Cause: The result set from the previous streaming query has not been completely read or has not been closed.

  3. Sequential access only: Streaming query utilizes the FORWARD_ONLY result set, which means that data can only be accessed row by row in the forward direction. It does not support randomly locating or rolling back to previous records. If your services involve frequent traversal or require random data access, do not use streaming query.
  4. Configuration and compatibility requirements: Streaming query requires special configurations (Trigger Conditions) in the JDBC driver or ORM framework. Without proper configurations, the desired outcome cannot be achieved.