pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
[pgjdbc/pgjdbc] PR #3996: fix: enable cursor-based fetching in extended protocol when transaction started via SQL command
8+ messages / 2 participants
[nested] [flat]

* [pgjdbc/pgjdbc] PR #3996: fix: enable cursor-based fetching in extended protocol when transaction started via SQL command
@ 2026-03-23 12:14 "vlsi (@vlsi)" <[email protected]>
  0 siblings, 0 replies; 8+ messages in thread

From: vlsi (@vlsi) @ 2026-03-23 12:14 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

When a user starts a transaction with `START TRANSACTION` or `BEGIN`SQL commands (instead of `setAutoCommit(false)`), cursor-based fetching was not activated because `PgStatement.executeInternal()` only checked `getAutoCommit()`.
The server is already in a transaction block in this case, so server-side cursors will survive across fetches.

The fix checks the actual server transaction state in addition to the autoCommit flag.

Fixes https://github.com/pgjdbc/pgjdbc/issues/3993


^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #3996: fix: enable cursor-based fetching in extended protocol when transaction started via SQL command
@ 2026-03-23 15:03 ` "davecramer (@davecramer)" <[email protected]>
  6 siblings, 0 replies; 8+ messages in thread

From: davecramer (@davecramer) @ 2026-03-23 15:03 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

we should probably check the transaction state before we do anything on the connection as well.

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #3996: fix: enable cursor-based fetching in extended protocol when transaction started via SQL command
@ 2026-03-23 15:09 ` "vlsi (@vlsi)" <[email protected]>
  6 siblings, 0 replies; 8+ messages in thread

From: vlsi (@vlsi) @ 2026-03-23 15:09 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

What do you mean?

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #3996: fix: enable cursor-based fetching in extended protocol when transaction started via SQL command
@ 2026-03-23 15:12 ` "davecramer (@davecramer)" <[email protected]>
  6 siblings, 0 replies; 8+ messages in thread

From: davecramer (@davecramer) @ 2026-03-23 15:12 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

Well since we are getting the transaction state from the queryExecutor just want to put a check in there to make sure that the query executor is instantiated correctly. So if we don't execute any statements what is the transaction state ?

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #3996: fix: enable cursor-based fetching in extended protocol when transaction started via SQL command
@ 2026-03-23 15:57 ` "vlsi (@vlsi)" <[email protected]>
  6 siblings, 0 replies; 8+ messages in thread

From: vlsi (@vlsi) @ 2026-03-23 15:57 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

I am not following your question.
There's a valid API use, and currently it skips using cursor (==It loads everything at once in a single go).
As far as I understand, the code wants to skip cursor in certain cases so the cursor does not disappear mid-fetch.

The condition for "use vs not use" the cursor was not quite right, so the condition could be lifted.

I don't understand how your question maps to the test case at hand

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #3996: fix: enable cursor-based fetching in extended protocol when transaction started via SQL command
@ 2026-03-23 16:00 ` "vlsi (@vlsi)" <[email protected]>
  6 siblings, 0 replies; 8+ messages in thread

From: vlsi (@vlsi) @ 2026-03-23 16:00 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

Do you mean "add a test case that a fresh connection responds IDLE transaction state"?

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #3996: fix: enable cursor-based fetching in extended protocol when transaction started via SQL command
@ 2026-03-23 17:18 ` "davecramer (@davecramer)" <[email protected]>
  6 siblings, 0 replies; 8+ messages in thread

From: davecramer (@davecramer) @ 2026-03-23 17:18 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

> Do you mean "add a test case that a fresh connection responds IDLE transaction state"?

yes

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #3996: fix: enable cursor-based fetching in extended protocol when transaction started via SQL command
@ 2026-03-24 07:06 ` "vlsi (@vlsi)" <[email protected]>
  6 siblings, 0 replies; 8+ messages in thread

From: vlsi (@vlsi) @ 2026-03-24 07:06 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

I've filed transaction state tests under https://github.com/pgjdbc/pgjdbc/pull/4006

^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2026-03-24 07:06 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-03-23 12:14 [pgjdbc/pgjdbc] PR #3996: fix: enable cursor-based fetching in extended protocol when transaction started via SQL command "vlsi (@vlsi)" <[email protected]>
2026-03-23 15:03 ` "davecramer (@davecramer)" <[email protected]>
2026-03-23 15:09 ` "vlsi (@vlsi)" <[email protected]>
2026-03-23 15:12 ` "davecramer (@davecramer)" <[email protected]>
2026-03-23 15:57 ` "vlsi (@vlsi)" <[email protected]>
2026-03-23 16:00 ` "vlsi (@vlsi)" <[email protected]>
2026-03-23 17:18 ` "davecramer (@davecramer)" <[email protected]>
2026-03-24 07:06 ` "vlsi (@vlsi)" <[email protected]>

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