Re: [BUGS] Segfault in 9.0 inlining SRF

2010-10-25 Thread Tom Lane
Brendan Jurd writes: > This whole business of passing around global pointers while switching > memory contexts seems like an optimal breeding-ground for bugs. Yeah. If it were to get significantly more complicated than this, the best solution IMO would be to give up on trying to use a temporary

Re: [BUGS] Segfault in 9.0 inlining SRF

2010-10-25 Thread Brendan Jurd
On 26 October 2010 03:42, Tom Lane wrote: > Brendan Jurd writes: >> Thanks for the hint; I found that the attached patch resolved my >> specific segfault, but I am wondering whether it goes far enough. > > Well, it definitely doesn't go far enough, because the invalItems list > has to be restored

Re: [BUGS] Segfault in 9.0 inlining SRF

2010-10-25 Thread Tom Lane
Brendan Jurd writes: > On 25 October 2010 07:36, Tom Lane wrote: >> 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. > Thanks for the hint; I found that the attached patch resolved my > sp

Re: [BUGS] Segfault in 9.0 inlining SRF

2010-10-25 Thread Brendan Jurd
On 25 October 2010 07:36, Tom Lane wrote: > Brendan Jurd 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 = 0x

Re: [BUGS] Segfault in 9.0 inlining SRF

2010-10-24 Thread Brendan Jurd
On 25 October 2010 07:36, Tom Lane wrote: > 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 > pro

Re: [BUGS] Segfault in 9.0 inlining SRF

2010-10-24 Thread Tom Lane
Brendan Jurd writes: > I have encountered a reproducible segfault in Postgres, and confirmed > it in 9.0.1 and HEAD on three separate machines. The bug was not > present in 8.4. I've attached a copy of the SQL script I have been > using to induce the segfault. > ... > I had a go at investigating

[BUGS] Segfault in 9.0 inlining SRF

2010-10-24 Thread Brendan Jurd
Hi folks, I have encountered a reproducible segfault in Postgres, and confirmed it in 9.0.1 and HEAD on three separate machines. The bug was not present in 8.4. I've attached a copy of the SQL script I have been using to induce the segfault. With asserts enabled, I get a failed assertion: TRAP