Re: [BUGS] Segfault in 9.0 inlining SRF - Mailing list pgsql-hackers

From Brendan Jurd
Subject Re: [BUGS] Segfault in 9.0 inlining SRF
Date
Msg-id AANLkTinVn+-KA3s+0M43anhR+z3KgUm+YC4uQHYCUZUq@mail.gmail.com
Whole thread Raw
In response to Re: [BUGS] Segfault in 9.0 inlining SRF  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [BUGS] Segfault in 9.0 inlining SRF
List pgsql-hackers
On 25 October 2010 07:36, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Brendan Jurd <direvus@gmail.com> writes:
>> I have encountered a reproducible segfault in Postgres ...
>
> Looks like the invalItems list has been clobbered:
>
> (gdb) p *root->glob->invalItems
> $6 = {type = 2139062143, length = 2139062143, head = 0x7f7f7f7f,
>  tail = 0x7f7f7f7f}
>
> I'm guessing it was modified in the temporary memory context and not
> properly copied out to the parent context when we finished inlining
> the function.
>

Hi Tom,

Thanks for the hint; I found that the attached patch resolved my
specific segfault, but I am wondering whether it goes far enough.  The
patch just copies invalItems up out of the temporary context before it
is deleted.  Could there also be changes to other elements of
PlannerGlobal that need to be saved?  Should we in fact be copying out
the whole of PlannerGlobal each time, and would that necessitate a new
copyfunc for it?

Cheers,
BJ

Attachment

pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: Range Types, discrete and/or continuous
Next
From: Andrew Dunstan
Date:
Subject: add label to enum syntax