OSDN Git Service

Preserve caller's memory context in ProcessCompletedNotifies().
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 27 May 2011 16:10:32 +0000 (12:10 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 27 May 2011 16:10:32 +0000 (12:10 -0400)
commit90857b48e1f69dbca52f498bd444190d36dbd73f
treefffdeea9752230f56a77c0639f259edb3c7b9e66
parent336db7e3474508b46a0e6bdb013a8bee5aac9adf
Preserve caller's memory context in ProcessCompletedNotifies().

This is necessary to avoid long-term memory leakage, because the main loop
in PostgresMain expects to be executing in MessageContext, and hence is a
bit sloppy about freeing stuff that is only needed for the duration of
processing the current client message.  The known case of an actual leak
is when encoding conversion has to be done on the incoming command string,
but there might be others.  Per report from Per-Olov Esgard.

Back-patch to 9.0, where the bug was introduced by the LISTEN/NOTIFY
rewrite.
src/backend/commands/async.c