Re: Server crash when describing a FETCH statement after its cursor is closed

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dirkjan Bussink <d(dot)bussink(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Server crash when describing a FETCH statement after its cursor is closed
Date: 2026-09-25 14:33:12
Message-ID: 1881624.1790346792@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dirkjan Bussink <d(dot)bussink(at)gmail(dot)com> writes:
> The following extended-protocol sequence crashes a backend (SIGSEGV
> in production builds, assertion failure in assert-enabled ones), and
> the postmaster terminates all other sessions for crash recovery:

Thanks for the report.

> The attached patch replaces the Assert with a runtime check returning
> NIL, mirroring the guard in UtilityTupleDescriptor(). A regression
> test is included.

I'm not convinced by this blithe assertion "not our business to raise
error". The adjacent case for ExecuteStmt *will* raise an error if
it can't find the prepared statement; why shouldn't this case act like
that one? IOW, the sequence of client operations that you show is
invalid, and I think we ought to push back on that accordingly.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Shlok Kyal 2026-09-25 14:33:19 Re: Support EXCEPT for ALL SEQUENCES publications
Previous Message Merlin Moncure 2026-09-25 14:14:14 Re: Up to 50x degradation in dblink performance when receiving notice traffic 19 vs 18