FRiCKLE/ngx_postgres — Issue #12: PQconsumeInput doesn't consume the whole input buffer
Author: liseen
Created: 2012-02-27 11:10:14+00:00
State: open

int PQconsumeInput(PGconn *conn)

PQconsumeInput function only call pqReadData once.

so if my pg output larger than 16kb( the initial size of libpq' in buffer), there maybe have some data in input buffer. In epoll EPOLLET mode, this is not right.

I haved patched libpq's code, PQconsumeInput function now call pqReadData in a while.

```C
while ((res = pqReadData(conn)) > 0)
;

if (res < 0)
return 0;
```

This patch solved my problem. and the response time is also reduced to the origin's 2/3.