pgpool2.git / summary / log / commit / refs
commit edaab73735ffff55b64ef7b60d0617f873a226bd
Author: Tatsuo Ishii <ishii@postgresql.org>
Date: Wed Sep 16 10:46:59 2026 +0000
Add check if parse tree exists in handle_query_context().
handle_query_context() did not check whether the parse tree existed in
session_context->query_context. Although, if it does not, there's
something wrong goes on.
Per Coverity.
Author: Tatsuo Ishii <ishii@postgresql.org>
Backpatch-through: v4.3
src/protocol/CommandComplete.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/protocol/CommandComplete.c b/src/protocol/CommandComplete.c
index 0c4d84d29..5578bb10b 100644
--- a/src/protocol/CommandComplete.c
+++ b/src/protocol/CommandComplete.c
@@ -304,6 +304,11 @@ handle_query_context(POOL_CONNECTION_POOL *backend)
/* Get session context */
session_context = pool_get_session_context(false);
+ /* parse tree does not exist (this should not happen) */
+ if (session_context->query_context == NULL ||
+ session_context->query_context->parse_tree == NULL)
+ return;
+
node = session_context->query_context->parse_tree;
/*
@@ -333,7 +338,6 @@ handle_query_context(POOL_CONNECTION_POOL *backend)
if (pool_config->disable_load_balance_on_write ==
DLBOW_DML_ADAPTIVE_GLOBAL &&
MAIN_REPLICA &&
- node != NULL &&
!session_context->is_in_transaction &&
session_context->transaction_temp_write_oid_list != NIL)
{