| From: | Tatsuo Ishii <ishii(at)postgresql(dot)org> |
|---|---|
| To: | pgpool-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgpool: Fix empty query case in aborted transaction. |
| Date: | 2026-05-19 06:16:25 |
| Message-ID: | E1wPDke-00BPgN-1k@gothos.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgpool-committers |
Fix empty query case in aborted transaction.
Commit eea522ebfcf791a623e865deaa1aa6fb59e3c50b changed user visible
behavior for empty queries (empty string or comment only queries) in
an explicit transaction in abort state. The commit missed the fact
that an empty query can be issued in the aborted state transaction
without any errors. As a result, an empty query raises "current
transaction is aborted, commands ignored until end of transaction
block" error by check_transaction_state_and_abort(), which is
wrong. Before the commit, the error was not raised.
This commit fixes the oversight by adding local flag "is_empty_query"
to SimpleQuery(). If the raw parser finds that a query is empty, the
flag is set to true. Then check_transaction_state_and_abort() is not
called and the empty query is forwarded to backend and processed just
like regular queries.
In passing, checking whether TSTATE in MAIN_NODE_ID is 'E' in
check_transaction_state_and_abort() is removed since it's not
necessary: subsequent code checks the transaction state by calling
pool_is_failed_transaction().
Also add test case to 128.aborted_transaction provided by raivil.
Reported-by: Ronaldo Raivil
Author: Tatsuo Ishii <ishii(at)postgresql(dot)org>
Discussion: https://github.com/pgpool/pgpool2/issues/161
Backpatch-through: v4.3
Branch
------
master
Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=aed190d0221dd15655cf57b3beea6a8c4c9aa2e1
Modified Files
--------------
src/protocol/pool_proto_modules.c | 34 +++++++++++-----------
.../tests/128.aborted_transaction/expected.txt | 22 ++++++++++++++
.../tests/128.aborted_transaction/test.sh | 11 +++++++
3 files changed, 50 insertions(+), 17 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tatsuo Ishii | 2026-05-19 09:21:06 | pgpool: Fix to not call pool_get_transaction_isolation() in elog(DEBUG) |
| Previous Message | Tatsuo Ishii | 2026-05-19 06:16:19 | pgpool: Fix empty query case in aborted transaction. |