Re: BUG #18944: Assertion Failure in psql with idle_session_timeout Set

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: n.kalinin@postgrespro.ru, pgsql-bugs@lists.postgresql.org
Cc: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
Date: 2025-06-02T08:13:48Z
Lists: pgsql-bugs
On Mon, Jun 02, 2025 at 06:34:12AM +0000, PG Bug reporting form wrote:
> Hello! When I execute the following query:
> psql <<EOF
> CREATE TABLE psql_pipeline(a INTEGER PRIMARY KEY, s TEXT);
> \startpipeline
> COPY psql_pipeline FROM STDIN;
> \syncpipeline
> \endpipeline
> EOF
> with `idle_session_timeout` set to, for example, 10000, I get the following
> error:
> FATAL:  terminating connection due to idle-session timeout
> psql: common.c:1501: discardAbortedPipelineResults: Assertion
> `pset.available_results > 0' failed.

Reproduced here, thanks for the report.  In this case, we are in a
PGRES_FATAL_ERROR state due to the timeout triggered by the backend,
and the loop discarding the results in discardAbortedPipelineResults()
does not take into account this case scenario: we don't have a result
to process yet, think that there is one, and kaboom.  It seems to me
that we should just add an extra case for the result = NULL case as
there is nothing pending.  A FATAL means that we need to give up
anyway.

Anthonin, what do you think?
--
Michael

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. psql: Forbid use of COPY and \copy while in a pipeline

  2. psql: Abort connection when using \syncpipeline after COPY TO/FROM