During join planning, the planner tries multiple combinations of joining relations, thus the same base or join relation can be part of multiple of combination. Hence remote_conds or joinclauses will get linked multiple times as they are bidirectional lists, thus breaking linkages of previous join combinations tried. E.g. while planning A join B join C join D planner will come up with combinations like A(B(CD)) or (AB)(CD) or ((AB)C)D etc. and remote_conds from A will first be linked into A(B(CD)), then AB breaking the first linkages.
On Tue, Feb 16, 2016 at 11:36 AM, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp > wrote: > On 2016/02/15 21:33, Ashutosh Bapat wrote: > >> Here's patch with better way to fix it. I think while concatenating the >> lists, we need to copy the lists being appended and in all the cases. If >> we don't copy, a change in those lists can cause changes in the upward >> linkages and thus lists of any higher level joins. >> > > Maybe I'm missing something, but I don't understand why such a change in > those lists happens. Could you explain about that in more detail? > > Best regards, > Etsuro Fujita > > > -- Best Wishes, Ashutosh Bapat EnterpriseDB Corporation The Postgres Database Company