From 176362c77d9a7af5d1897d1fb7d6a3fdf95efef5 Mon Sep 17 00:00:00 2001 From: Rahim Kanji Date: Mon, 23 Feb 2026 14:00:44 +0500 Subject: [PATCH] Addressed feedback from AI review --- include/PgSQL_Session.h | 2 +- lib/PgSQL_Session.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/PgSQL_Session.h b/include/PgSQL_Session.h index 396235a18..b78b2af45 100644 --- a/include/PgSQL_Session.h +++ b/include/PgSQL_Session.h @@ -417,7 +417,7 @@ private: * @param command Command that causes the session to switch to fast forward mode. * @param session_type SESSION_FORWARD_TYPE indicating the type of session. * - * @return void. + * @return bool. */ bool switch_normal_to_fast_forward_mode(PtrSize_t& pkt, std::string_view command, SESSION_FORWARD_TYPE session_type); diff --git a/lib/PgSQL_Session.cpp b/lib/PgSQL_Session.cpp index facea8850..3cbdcc085 100644 --- a/lib/PgSQL_Session.cpp +++ b/lib/PgSQL_Session.cpp @@ -2951,7 +2951,7 @@ handler_again: goto __exit_DSS__STATE_NOT_INITIALIZED; } - if (!switch_normal_to_fast_forward_mode(pkt, std::string(matched.data(), matched.size()), SESSION_FORWARD_TYPE_COPY_FROM_STDIN_STDOUT)) { + if (!switch_normal_to_fast_forward_mode(pkt, std::string_view(matched.data(), matched.size()), SESSION_FORWARD_TYPE_COPY_FROM_STDIN_STDOUT)) { // Failed to switch to fast forward mode due to pending packets client_myds->setDSS_STATE_QUERY_SENT_NET(); client_myds->myprot.generate_error_packet(true, true, "Unexpected packet sequence during COPY command", @@ -5664,8 +5664,8 @@ bool PgSQL_Session::switch_normal_to_fast_forward_mode(PtrSize_t& pkt, std::stri // Check if there are pending packets in client_myds->PSarrayIN // This is an error condition, we cannot switch to fast forward mode if (client_myds->PSarrayIN->len) { - proxy_error("Cannot switch to fast forward mode: unexpected pending packets in client_myds->PSarrayIN (len=%d). Command: %s\n", - client_myds->PSarrayIN->len, command.data()); + proxy_error("Cannot switch to fast forward mode: unexpected pending packets in client_myds->PSarrayIN (len=%u). Command: %.*s\n", + client_myds->PSarrayIN->len, (int)command.size(), command.data()); return false; }