postgresql/src/interfaces/libpq
Tom Lane d014b38df6 In libpq, free any partial query result before collecting a server error.
We'd throw away the partial result anyway after parsing the error message.
Throwing it away beforehand costs nothing and reduces the risk of
out-of-memory failure.  Also, at least in systems that behave like
glibc/Linux, if the partial result was very large then the error PGresult
would get allocated at high heap addresses, preventing the heap storage
used by the partial result from being released to the OS until the error
PGresult is freed.

In psql >= 9.6, we hold onto the error PGresult until another error is
received (for \errverbose), so that this behavior causes a seeming
memory leak to persist for awhile, as in a recent complaint from
Darafei Praliaskouski.  This is a potential performance regression from
older versions, justifying back-patching at least that far.  But similar
behavior may occur in other client applications, so it seems worth just
back-patching to all supported branches.

Discussion: https://postgr.es/m/CAC8Q8tJ=7cOkPePyAbJE_Pf691t8nDFhJp0KZxHvnq_uicfyVg@mail.gmail.com
2018-04-13 12:53:45 -04:00
..
po Translation updates 2018-02-26 08:28:54 -05:00
test Fix script name in README. 2017-06-09 12:05:03 +03:00
.gitignore Add missing erand48.c to libpq/.gitignore. 2017-04-20 16:31:28 -04:00
exports.txt Add PQencryptPasswordConn function to libpq, use it in psql and createuser. 2017-05-03 11:19:07 +03:00
fe-auth-scram.c Tweak some SCRAM error messages and code comments 2017-08-23 12:29:47 -04:00
fe-auth.c Fix up references to scram-sha-256 2018-01-30 17:05:35 -05:00
fe-auth.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
fe-connect.c Fix wording of "hostaddrs" 2018-01-21 13:43:20 +01:00
fe-exec.c Teach libpq to detect integer overflow in the row count of a PGresult. 2017-08-29 15:18:01 -04:00
fe-lobj.c Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
fe-misc.c Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
fe-print.c Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
fe-protocol2.c In libpq, free any partial query result before collecting a server error. 2018-04-13 12:53:45 -04:00
fe-protocol3.c In libpq, free any partial query result before collecting a server error. 2018-04-13 12:53:45 -04:00
fe-secure-openssl.c Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
fe-secure.c Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
libpq-events.c Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
libpq-events.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
libpq-fe.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
libpq-int.h Allow multiple hostaddrs to go with multiple hostnames. 2017-07-10 12:28:57 +03:00
libpq.rc.in Stamp 10.3. 2018-02-26 17:10:47 -05:00
Makefile Add newly-symlinked files to "make clean" target. 2017-04-08 14:25:45 -04:00
nls.mk Translation updates 2018-02-05 12:27:10 -05:00
pg_service.conf.sample Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
pqexpbuffer.c Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pqexpbuffer.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pthread-win32.c Remove useless duplicate inclusions of system header files. 2017-02-25 16:12:55 -05:00
README Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
win32.c Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
win32.h Remove support for bcc and msvc standalone libpq builds 2017-04-11 15:22:21 +02:00

src/interfaces/libpq/README

This directory contains the C version of Libpq, the POSTGRES frontend library.