Insert into getCopyDataMessage() the same logic that already existed in the
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 17 Jan 2008 21:21:50 +0000 (21:21 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 17 Jan 2008 21:21:50 +0000 (21:21 +0000)
commit8d14da5418076e4c6bc0358e96212ddc40ae3bf5
tree422ded5abd340ba8aacf4e637d49b92ed872233c
parente1325350617bda70f81fb75e899ea92bee19b8db
Insert into getCopyDataMessage() the same logic that already existed in the
main code path for enlarging libpq's input buffer in one swoop when needing to
read a long data message.  Without this, the code will double the buffer size,
read more data, notice it still hasn't got the whole message, and repeat till
it finally has a large enough buffer.  Which wastes a lot of data-moving
effort and also memory (since malloc probably can't do anything very useful
with the freed-up smaller buffers).  Not sure why this wasn't there already;
certainly the COPY data path is a place where we're quite likely to see long
data messages.  I'm not backpatching though, since this is just a marginal
performance issue rather than a real bug.
src/interfaces/libpq/fe-protocol3.c