Re: BUG #19438: segfault with temp_file_limit inside cursor

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Rowley <dgrowleyml@gmail.com>
Cc: kuzmin.db4@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2026-03-30T16:29:20Z
Lists: pgsql-bugs

Attachments

I wrote:
> Works for me.  I'm done for the day but will make it so tomorrow.

Pushed that, though in the event I wrote a rather longer apologia
for why we use ERROR in one complaint and WARNING in the other.

Getting back to the original bug ... I went through tuplestore.c
and found two other places where foreseeable failures in subroutines
could leave the tuplestore in an inconsistent state.  I think we
need to fix them all, per the attached draft against HEAD.  The
back branches might have more/different bugs, didn't look yet.

			regards, tom lane

Commits

  1. Be more careful to preserve consistency of a tuplestore.

  2. Detect pfree or repalloc of a previously-freed memory chunk.

  3. Improve performance of and reduce overheads of memory management