From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix leaked hash scans in pg_listening_channels().
Date: Sun, 25 Oct 2026 19:14:19 +0000
Message-ID: <E1xL3ff-00000000jQh-2VgB@gemulon.postgresql.org> (raw)
Fix leaked hash scans in pg_listening_channels().
Commit 282b1cde9 changed pg_listening_channels() to keep a hash table
scan open between calls of this set-returning function. If the
executor stops fetching rows early, as with a target-list call under
LIMIT, the scan remains registered until transaction end, resulting in
leak complaints and eventually a PANIC.
Instead materialize the result in a tuplestore, so that we can
complete the hash scan within a single call.
Author: Joel Jacobson <joel@compiler.org>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/069fc976-bee1-4f0f-b22b-86ef7ed4f9ff@app.fastmail.com
Backpatch-through: 19
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/dfd7ede529f288639760444a9c69f3f7bb65450c
Modified Files
--------------
src/backend/commands/async.c | 56 ++++++++++++++-----------------------
src/test/regress/expected/async.out | 7 +++++
src/test/regress/sql/async.sql | 4 +++
3 files changed, 32 insertions(+), 35 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Fix leaked hash scans in pg_listening_channels().
In-Reply-To: <E1xL3ff-00000000jQh-2VgB@gemulon.postgresql.org>
References: <E1xL3ff-00000000jQh-2VgB@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox