From 34c3f200208cb2baebc4410aad78a06503e2cb13 Mon Sep 17 00:00:00 2001 From: Taiki Koshino Date: Wed, 30 Sep 2026 06:39:19 +0900 Subject: [PATCH v1] Fix SQLSTATE for Bind referencing a nonexistent prepared statement. When Bind referenced a nonexistent prepared statement, Pgpool-II returned SQLSTATE XX000 (internal_error), whereas PostgreSQL returned 26000 (invalid_sql_statement_name). The error messages were the same, but the SQLSTATE values were inconsistent. Change the SQLSTATE to 26000 to match PostgreSQL. The error message and connection recovery behavior remain unchanged. Author: Taiki Koshino koshino@sraoss.co.jp Discussion: https://github.com/pgpool/pgpool2/issues/180 Backpatch-through: v4.3 --- src/protocol/pool_proto_modules.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/protocol/pool_proto_modules.c b/src/protocol/pool_proto_modules.c index a303c922b..14fb9f583 100644 --- a/src/protocol/pool_proto_modules.c +++ b/src/protocol/pool_proto_modules.c @@ -1799,7 +1799,7 @@ Bind(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend, /* send error message to frontend */ errmessage = psprintf("prepared statement \"%s\" does not exist", pstmt_name); - pool_send_error_message(frontend, MAJOR(cp), "XX000", errmessage, + pool_send_error_message(frontend, MAJOR(cp), "26000", errmessage, "", "", __FILE__, __LINE__); pfree(errmessage); -- 2.52.0