Skip to content

Commit 9eb934e

Browse files
committed
Buffer response until Extended Query frame completes; send early only if resultset threshold is reached.
1 parent 9fa3d75 commit 9eb934e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/PgSQL_Session.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2651,6 +2651,7 @@ int PgSQL_Session::handler() {
26512651
#endif // ENABLE_TIMER
26522652
int handler_ret = 0;
26532653
bool wrong_pass = false;
2654+
bool in_pending_state = false;
26542655
if (to_process == 0) return 0; // this should be redundant if the called does the same check
26552656
proxy_debug(PROXY_DEBUG_NET, 1, "Thread=%p, Session=%p -- Processing session %p\n", this->thread, this, this);
26562657
//unsigned int j;
@@ -3125,6 +3126,8 @@ int PgSQL_Session::handler() {
31253126
case 1:
31263127
if (myconn->query_result && myconn->query_result->get_resultset_size() > (unsigned int)pgsql_thread___threshold_resultset_size) {
31273128
myconn->query_result->get_resultset(client_myds->PSarrayOUT);
3129+
} else {
3130+
in_pending_state = true;
31283131
}
31293132
break;
31303133
// rc==2 : a multi-resultset (or multi statement) was detected, and the current statement is completed
@@ -3217,7 +3220,8 @@ int PgSQL_Session::handler() {
32173220
}
32183221
}
32193222

3220-
writeout();
3223+
if (!in_pending_state)
3224+
writeout();
32213225

32223226
if (wrong_pass == true) {
32233227
client_myds->array2buffer_full();

0 commit comments

Comments
 (0)