| 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:15:57 |
| Message-ID: | E1wPDkC-00BPB3-2L@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
------
V4_3_STABLE
Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=6c5abed3b8d8ff995f4c46584241c40c08709aa6
Modified Files
--------------
src/protocol/pool_proto_modules.c | 34 +++++++++++-----------
.../tests/078.aborted_transaction/expected.txt | 22 ++++++++++++++
.../tests/078.aborted_transaction/test.sh | 11 +++++++
3 files changed, 50 insertions(+), 17 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tatsuo Ishii | 2026-05-19 06:16:02 | pgpool: Fix empty query case in aborted transaction. |
| Previous Message | Taiki Koshino | 2026-05-13 04:02:59 | pgpool: Doc: update copyright. |