From abbe02d99fed187100aaba4479f04742d9c62733 Mon Sep 17 00:00:00 2001 From: Rahim Kanji Date: Tue, 10 Dec 2024 15:29:33 +0500 Subject: [PATCH] Implemented logic to store results with notices in the Query Cache --- lib/PgSQL_Connection.cpp | 2 +- lib/PgSQL_Session.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/PgSQL_Connection.cpp b/lib/PgSQL_Connection.cpp index 85ee222bc..1282d0d91 100644 --- a/lib/PgSQL_Connection.cpp +++ b/lib/PgSQL_Connection.cpp @@ -2877,7 +2877,7 @@ void PgSQL_Connection::unhandled_notice_cb(void* arg, const PGresult* result) { assert(arg); PgSQL_Connection* conn = (PgSQL_Connection*)arg; proxy_error("Unhandled notice: '%s' received from backend [PID: %d] (Host: %s, Port: %d, User: %s, FD: %d, State: %d). Please report this issue for further investigation and enhancements.\n", - PQresultErrorMessage(result), conn->get_pg_backend_pid(), conn->get_pg_host(), conn->get_pg_port(), conn->get_pg_user(), conn->get_pg_socket_fd(), conn->async_state_machine); + PQresultErrorMessage(result), conn->get_pg_backend_pid(), conn->get_pg_host(), atoi(conn->get_pg_port()), conn->get_pg_user(), conn->get_pg_socket_fd(), (int)conn->async_state_machine); #ifdef DEBUG assert(0); #endif diff --git a/lib/PgSQL_Session.cpp b/lib/PgSQL_Session.cpp index ff8ec5523..9e9fcf2dd 100644 --- a/lib/PgSQL_Session.cpp +++ b/lib/PgSQL_Session.cpp @@ -6260,7 +6260,8 @@ void PgSQL_Session::PgSQL_Result_to_PgSQL_wire(PgSQL_Connection* _conn, PgSQL_Da if (query_result && query_result->get_result_packet_type() != PGSQL_QUERY_RESULT_NO_DATA) { bool transfer_started = query_result->is_transfer_started(); // if there is an error, it will be false so results are not cached - bool is_tuple = query_result->get_result_packet_type() == (PGSQL_QUERY_RESULT_TUPLE | PGSQL_QUERY_RESULT_COMMAND | PGSQL_QUERY_RESULT_READY); + bool is_tuple = query_result->get_result_packet_type() == ((PGSQL_QUERY_RESULT_TUPLE | PGSQL_QUERY_RESULT_COMMAND | PGSQL_QUERY_RESULT_READY) || + (PGSQL_QUERY_RESULT_NOTICE | PGSQL_QUERY_RESULT_TUPLE | PGSQL_QUERY_RESULT_COMMAND | PGSQL_QUERY_RESULT_READY)); const uint64_t num_rows = query_result->get_num_rows(); const uint64_t resultset_size = query_result->get_resultset_size(); const auto _affected_rows = query_result->get_affected_rows();