Re: PostgreSQL crashes with SIGSEGV

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Aleksandr Parfenov <a(dot)parfenov(at)postgrespro(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: PostgreSQL crashes with SIGSEGV
Date: 2018-02-06 22:27:47
Message-ID: CAH2-Wzm83typmXzf2vpJRHO4pd6zjUvBoaUBfNesS=aHUn1K3Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Wed, Jan 17, 2018 at 2:23 PM, Peter Geoghegan <pg(at)bowt(dot)ie> wrote:
> A complicating factor for this fix of mine is that mode_final() seems
> to have its own ideas about tuple memory lifetime, over and above what
> tuplesort_getdatum() explicitly promises, as can be seen here:
>
> /*
> * Note: we *cannot* clean up the tuplesort object here, because the value
> * to be returned is allocated inside its sortcontext. We could use
> * datumCopy to copy it out of there, but it doesn't seem worth the
> * trouble, since the cleanup callback will clear the tuplesort later.
> */

> ISTM that either grouping sets or mode_final() must necessarily be
> wrong, because each oversteps, and infers a different contract from
> tuplesort tuple fetching routines (different assumptions about memory
> contexts are made in each case). Only one can be right, unless it's
> okay to have one rule for tuplesort_getdatum() and another for
> tuplesort_gettupleslot() (which seems questionable to me). I still
> think that grouping sets is right (and that mode_final() is wrong). Do
> you?

It would be nice to get an opinion on this mode_final() + tuplesort
memory lifetime business from you, Tom.

Note that you removed the quoted comment within be0ebb65, back in October.

--
Peter Geoghegan

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Orian Beltrame da Silva 2018-02-06 22:44:01 Re: BUG #15053: SIGSEGV - While executing query with cube agregator
Previous Message Peter Geoghegan 2018-02-06 22:14:40 Re: BUG #15053: SIGSEGV - While executing query with cube agregator

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2018-02-06 23:03:26 Re: Temporary tables prevent autovacuum, leading to XID wraparound
Previous Message Tomas Vondra 2018-02-06 22:21:15 Re: [HACKERS] Parallel tuplesort (for parallel B-Tree index creation)