pg.ddx.io pgaudit/pgaudit GitHub issues and pull requests
help / color / mirror / Atom feed[pgaudit/pgaudit] issue #298: Add exception for fetch statement to stack check.
5+ messages / 2 participants
[nested] [flat]
* [pgaudit/pgaudit] issue #298: Add exception for fetch statement to stack check.
@ 2025-12-24 00:25 "SerTitan (@SerTitan)" <noreply+SerTitan@github.com>
0 siblings, 0 replies; 5+ messages in thread
From: SerTitan (@SerTitan) @ 2025-12-24 00:25 UTC (permalink / raw)
To: pgaudit/pgaudit <noreply+pgaudit-pgaudit@github.com>
This issue is closely related to the previous fix introduced in [PR #249](https://github.com/pgaudit/pgaudit/pull/249), which addressed the `pgaudit stack is not empty` error by allowing additional statement types to remain on the audit stack.
During execution of a transaction that fetches data from a refcursor. After investigation, we found that a FETCH statement remains on the audit stack at the moment of stack validation.
We were able to reproduce the issue using JDBC with cursor-based execution enabled. For reproduction, the following JDBC settings were used:
- setAutoCommit(false)
- PreparedStatement.setFetchSize(n), n > 0
The transaction was executed as a single JDBC statement and contains a stored procedure call followed by cursor fetch and close:
```
BEGIN;
DO $$
DECLARE
var_ImplicitCallerRetVal int;
var_ImplicitResultSet refcursor := 'var_implicitresultset';
BEGIN
CALL test_outer(var_ImplicitCallerRetVal, var_ImplicitResultSet);
IF NOT EXISTS (
SELECT 1 FROM pg_cursors WHERE name = 'var_implicitresultset'
) THEN
OPEN var_ImplicitResultSet FOR
SELECT 0 AS ResultSetNotFound WHERE 0 = 1;
END IF;
END;
$$;
FETCH ALL FROM var_implicitresultset;
CLOSE var_implicitresultset;
COMMIT;
```
During execution, the **T_FetchStmt** is pushed onto the pgaudit stack. As a result, the `pgaudit stack is not empty` at **CLOSE** statement. To align this behavior with the fix introduced in [PR #249](https://github.com/pgaudit/pgaudit/pull/249), **FETCH** can be treated as an additional allowed statement type during audit stack validation.
^ permalink raw [nested|flat] 5+ messages in thread
* Re: [pgaudit/pgaudit] issue #298: Add exception for fetch statement to stack check.
@ 2026-06-26 08:49 "dwsteele (@dwsteele)" <noreply+dwsteele@github.com>
3 siblings, 0 replies; 5+ messages in thread
From: dwsteele (@dwsteele) @ 2026-06-26 08:49 UTC (permalink / raw)
To: pgaudit/pgaudit <noreply+pgaudit-pgaudit@github.com>
@dwsteele assigned @dwsteele.
^ permalink raw [nested|flat] 5+ messages in thread
* Re: [pgaudit/pgaudit] issue #298: Add exception for fetch statement to stack check.
@ 2026-06-26 08:49 "dwsteele (@dwsteele)" <noreply+dwsteele@github.com>
3 siblings, 0 replies; 5+ messages in thread
From: dwsteele (@dwsteele) @ 2026-06-26 08:49 UTC (permalink / raw)
To: pgaudit/pgaudit <noreply+pgaudit-pgaudit@github.com>
@dwsteele applied label "bug".
^ permalink raw [nested|flat] 5+ messages in thread
* Re: [pgaudit/pgaudit] issue #298: Add exception for fetch statement to stack check.
@ 2026-06-26 08:50 "dwsteele (@dwsteele)" <noreply+dwsteele@github.com>
3 siblings, 0 replies; 5+ messages in thread
From: dwsteele (@dwsteele) @ 2026-06-26 08:50 UTC (permalink / raw)
To: pgaudit/pgaudit <noreply+pgaudit-pgaudit@github.com>
@dwsteele closed this.
^ permalink raw [nested|flat] 5+ messages in thread
* Re: [pgaudit/pgaudit] issue #298: Add exception for fetch statement to stack check.
@ 2026-06-26 08:50 "dwsteele (@dwsteele)" <noreply+dwsteele@github.com>
3 siblings, 0 replies; 5+ messages in thread
From: dwsteele (@dwsteele) @ 2026-06-26 08:50 UTC (permalink / raw)
To: pgaudit/pgaudit <noreply+pgaudit-pgaudit@github.com>
This is fixed in PR #324. Please have a look.
^ permalink raw [nested|flat] 5+ messages in thread
end of thread, other threads:[~2026-06-26 08:50 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-12-24 00:25 [pgaudit/pgaudit] issue #298: Add exception for fetch statement to stack check. "SerTitan (@SerTitan)" <noreply+SerTitan@github.com>
2026-06-26 08:49 ` "dwsteele (@dwsteele)" <noreply+dwsteele@github.com>
2026-06-26 08:49 ` "dwsteele (@dwsteele)" <noreply+dwsteele@github.com>
2026-06-26 08:50 ` "dwsteele (@dwsteele)" <noreply+dwsteele@github.com>
2026-06-26 08:50 ` "dwsteele (@dwsteele)" <noreply+dwsteele@github.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox