| From: | Tatsuo Ishii <ishii(at)postgresql(dot)org> |
|---|---|
| To: | pgpool-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgpool: Fix Describe to not raise a FATAL error with nonexistent prepar |
| Date: | 2026-11-14 00:58:03 |
| Message-ID: | E1xS25j-00000001rmq-3JPt@gothos.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgpool-committers |
Fix Describe to not raise a FATAL error with nonexistent prepared statement.
Previously Describe() threw a FATAL error (and disconnected the
session) if nonexistent prepared statement is provided. This is an
incompatible behavior with PostgreSQL since it returns an ERROR
response and clients can continue the session in this case.
To fix this, create a dummy query context so that the Describe message
is sent to the primary node and an error response is returned from
PostgreSQL. Note that create_dummy_query_context() creates a query
context for a write query.
Below is the minimum test data for pgproto.
'D' 'S' "missing_prepared"
'S'
'Y'
'Q' "SELECT 1"
'Y'
'X'
And expected response. The session is killed anymore and following
simple query returns rows on the same session.
FE=> Describe(stmt="missing_prepared")
FE=> Sync
<= BE ErrorResponse(S ERROR V ERROR C 26000 M prepared statement "missing_prepared" does not exist F prepare.c L 451 R FetchPreparedStatement )
<= BE ReadyForQuery(I)
FE=> Query (query="SELECT 1")
<= BE RowDescription
<= BE DataRow
<= BE CommandComplete(SELECT 1)
<= BE ReadyForQuery(I)
FE=> Terminate
Also a regression test case for this is added.
Reported-by: apkipa
Author: Tatsuo Ishii <ishii(at)postgresql(dot)org>
Discussion: https://github.com/pgpool/pgpool2/issues/169
Backpatch-through: v4.3
Branch
------
master
Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=b2440bdc75521fca2b2a81de067669fc7fd263a8
Modified Files
--------------
src/protocol/pool_proto_modules.c | 18 ++++++----
.../tests/135.describe_bugs/expected.txt | 10 ++++++
.../tests/135.describe_bugs/pgproto.data | 7 ++++
.../regression/tests/135.describe_bugs/test.sh | 41 ++++++++++++++++++++++
4 files changed, 69 insertions(+), 7 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tatsuo Ishii | 2026-11-14 11:40:06 | pgpool: Fix terminate_all_childrens() to not block in waitpid(). |
| Previous Message | Tatsuo Ishii | 2026-11-14 00:57:58 | pgpool: Fix Describe to not raise a FATAL error with nonexistent prepar |