Tomas Berndtsson <tomas(at)nocrew(dot)org> writes:
> However, after some semi-random looking through the source code of
> libpq, I tried to change a value, namely here:
> fe-misc.c row 510 in pqReadData():
> if (conn->inEnd > 32768 &&
> (conn->inBufSize - conn->inEnd) >= 8192)
> I changed the 32768 value to 131072, and sure enough, my application
> was able to get larger fields without any errors.
That's really interesting. I cannot see anything unsafe about that
retry loop --- could you instrument it some more to determine exactly
what happens after we go back to try to read more?
Also, are you using SSL by any chance? Perhaps the problem is that
the SSL library doesn't react the same as a bare recv() call?
regards, tom lane