pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
From: helloJosh (@helloJosh) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: [pgjdbc/pgjdbc] PR #3870: feat: Add INFO log when fetchSize is ignored under autocommit=true
Date: Mon, 24 Nov 2025 15:51:40 +0000
Message-ID: <[email protected]> (raw)

First of all, Thank you for maintaining pgjdbc. As someone who relies on PostgreSQL heavily, I really appreciate the effort that goes into this project

If it's not too much trouble, I would like to get feedback on whether adding this log message is acceptable.

### Motivation
While using Spring Batch with JdbcCursorItemReader, our application repeatedly hit OOM because fetchSize was silently ignored when the connection ran with autocommit=true. Although the documentation notes that server-side cursors require autocommit=false, this detail becomes easy to miss when multiple application are involved.
I initially considered implementing a WITH HOLD cursor, but the complexity was non-trivial. So, I am proposing to surface this behavior through an INFO-level log.

### Why INFO
- Users typically set fetchSize because the result set is large.
- Many users expect streaming behavior even when autocommit is true(or may not realize autocommit is enabled).
- This log appears only when fetchSize > 0 and autocommit=true, so it does not introduce noisy logging in unrelated cases.

### What is changed
- Add an INFO-level log in PgStatement.executeInternal when:
  - fetchSize > 0
  - autocommit = true
  - when driver connot use a server-side cursor
- No behavior change
  - cursor flags untouched
- No new test
  - tests passed locally


view thread (7+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: github://pgjdbc/pgjdbc
  Cc: [email protected], [email protected]
  Subject: Re: [pgjdbc/pgjdbc] PR #3870: feat: Add INFO log when fetchSize is ignored under autocommit=true
  In-Reply-To: <<[email protected]>>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox