From 97b3bb16e31a76181e623a6563ac2cc17af88efe Mon Sep 17 00:00:00 2001 From: Rahim Kanji Date: Mon, 23 Jun 2025 00:22:11 +0500 Subject: [PATCH] Fixed RequestEnd --- lib/PgSQL_Session.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/PgSQL_Session.cpp b/lib/PgSQL_Session.cpp index 0eed13406..0a4d85073 100644 --- a/lib/PgSQL_Session.cpp +++ b/lib/PgSQL_Session.cpp @@ -5494,18 +5494,20 @@ void PgSQL_Session::RequestEnd(PgSQL_Data_Stream* myds, const unsigned int myerr qdt = CurrentQuery.stmt_info->digest_text; } - // is savepoint currently present in transaction. - int savepoint_count = -1; // haven't checked yet + if (qdt) { + // is savepoint currently present in transaction. + int savepoint_count = -1; // haven't checked yet - // we do not maintain the transaction variable state if the session is locked on a hostgroup - // or is a Fast Forward session. - if (locked_on_hostgroup == -1 && session_fast_forward == SESSION_FORWARD_TYPE_NONE) { - transaction_state_manager->handle_transaction(qdt); - savepoint_count = transaction_state_manager->get_savepoint_count(); - } + // we do not maintain the transaction variable state if the session is locked on a hostgroup + // or is a Fast Forward session. + if (locked_on_hostgroup == -1 && session_fast_forward == SESSION_FORWARD_TYPE_NONE) { + transaction_state_manager->handle_transaction(qdt); + savepoint_count = transaction_state_manager->get_savepoint_count(); + } - if (qdt && myds && myds->myconn) { - myds->myconn->ProcessQueryAndSetStatusFlags(qdt, savepoint_count); + if (myds && myds->myconn) { + myds->myconn->ProcessQueryAndSetStatusFlags(qdt, savepoint_count); + } } if (session_fast_forward == SESSION_FORWARD_TYPE_NONE) {