Re: BUG #11457: The below query crashes 9.3.5, but not 9.3.4 - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #11457: The below query crashes 9.3.5, but not 9.3.4
Date
Msg-id 7269.1411750638@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #11457: The below query crashes 9.3.5, but not 9.3.4  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: BUG #11457: The below query crashes 9.3.5, but not 9.3.4
List pgsql-bugs
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> Nelson Page wrote:
>> As mentioned in the original title, we cannot reproduce this crash in 9.3.4, but can in 9.3.5.  So our particular
crashdoes not go back to 9.1 (unless the 9.1 you mention is some other context maybe?) 

> Bug fixes are backpatched to supported branches; 9.3.4 is older than
> 9.1.14.  9.1.14 does contain the backpatched bug fix which seems to have
> introduced the new bug:

The Assert failure mentioned in the other thread reproduces for me back to
9.2; that one is contingent on trying to build a parameterized path, so
of course it wouldn't occur before 9.2.  But I imagine other variants of
this issue can be reproduced further back.  The fundamental problem is
that we still have work to do to make nested appendrels behave properly.

I think basically the issue here is that in some situations we really want
to find the top-level ancestor appendrel, not just the immediate parent,
as it is the top-level ancestor that will be mentioned in join clauses,
ORDER BY, etc.

I came across a closely related issue too: in
generate_join_implied_equalities_broken we try to translate original join
clauses to apply to a particular child rel by applying the Var translation
from the AppendRelInfo for that child.  I think this is wrong for the same
reasons: the original join clause will mention top-level ancestor Vars,
meaning we need to successively apply all the translations working down to
the descendant if we want a correct result.

We could probably hack solutions to these problems without changing the
AppendRelInfo data structures, but I'm wondering if it wouldn't be a good
idea to redefine them or at least add more fields to make it easier to
work with multi-level appendrel ancestry.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Nelson Page
Date:
Subject: Re: BUG #11457: The below query crashes 9.3.5, but not 9.3.4
Next
From: Tom Lane
Date:
Subject: Re: BUG #11500: PRIMARY KEY index not being used