Re: [sqlsmith] Crash in apply_projection_to_path - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [sqlsmith] Crash in apply_projection_to_path
Date
Msg-id 13430.1461938599@sss.pgh.pa.us
Whole thread Raw
In response to Re: [sqlsmith] Crash in apply_projection_to_path  (Amit Kapila <amit.kapila16@gmail.com>)
Responses Re: [sqlsmith] Crash in apply_projection_to_path
List pgsql-hackers
Amit Kapila <amit.kapila16@gmail.com> writes:
>> On Thu, Apr 28, 2016 at 10:06 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> I'd be inclined to think that it's silly to build GatherPaths in advance
>>> of having finalized the list of partial paths for a rel.

> What's happening here is that to form joinrel, we need to call
> add_paths_to_joinrel() with both outer and inner relation twice, once with
> rel1 as outer relation and rel1 as inner relation and vice versa.  So now
> the second call to add_paths_to_joinrel() can replace a partial path which
> is being referenced by GatherPath generated in first call.  I think we
> should generate gather paths for join rel after both the calls
> to add_paths_to_joinrel() aka in make_join_rel().  Attached patch on above
> lines fixes the problem for me.

make_join_rel is certainly not far enough down the call stack to solve
this problem.  It can, and typically will, be invoked multiple times
for the same target join relation.

One possible answer is to do it in standard_join_search, just before
the set_cheapest call for each join relation.  You'd need to account
for the issue in GEQO search as well.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: VS 2015 support in src/tools/msvc
Next
From: Magnus Hagander
Date:
Subject: Re: Typo