Since notices can reorder packets, it is important to account for this when calculating the result set size

pull/4770/head
Rahim Kanji 1 year ago
parent 1c5ba94c74
commit f0316c7d50

@ -1421,7 +1421,7 @@ unsigned int PgSQL_Protocol::copy_row_description_to_PgSQL_Query_Result(bool sen
// if (dump_pkt) { __dump_pkt(__func__, _ptr, size); }
//#endif
pg_query_result->resultset_size = size;
pg_query_result->resultset_size += size;
if (alloced_new_buffer) {
// we created new buffer
@ -1843,7 +1843,7 @@ unsigned int PgSQL_Protocol::copy_out_response_start_to_PgSQL_Query_Result(bool
// if (dump_pkt) { __dump_pkt(__func__, _ptr, size); }
//#endif
pg_query_result->resultset_size = size;
pg_query_result->resultset_size += size;
if (alloced_new_buffer) {
// we created new buffer

@ -6260,8 +6260,10 @@ 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) ||
(PGSQL_QUERY_RESULT_NOTICE | 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)) ||
(query_result->get_result_packet_type() == (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();

Loading…
Cancel
Save