From: | Richard Guo <guofenglinux(at)gmail(dot)com> |
---|---|
To: | Andrey Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru> |
Cc: | PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Clause accidentally pushed down ( Possible bug in Making Vars outer-join aware) |
Date: | 2023-02-23 06:36:34 |
Message-ID: | CAMbWs4_XcPHqc=A=36cxvJRhkjAgEeJtOFLOnBPEfQYGqnGOCw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Thu, Feb 23, 2023 at 11:29 AM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
> On Wed, Feb 22, 2023 at 6:24 PM Richard Guo <guofenglinux(at)gmail(dot)com>
> wrote:
>
>> ISTM that for outer join identity 3, if we are given form
>> (A leftjoin B on (Pab)) leftjoin C on (Pbc)
>> then references to C Vars in higher qual levels would be marked with the
>> B/C join. If we've transformed it to form
>> A leftjoin (B leftjoin C on (Pbc)) on (Pab)
>> then references to C Vars in higher qual levels should be adjusted to
>> include both B/C join and A/B join in their varnullingrels.
>>
>
> A quick hack that comes to my mind is that for a pushed down clause we
> check all outer join relids it mentions and add the outer joins'
> commute_below to the clause's required_relids, so that after we've
> commuted the outer joins, the clause would still be placed in the right
> place.
>
I've realized this hack is not correct :-(. References to A Vars and B
Vars in higher qual levels do not need this adjustment. So this code
change would add unnecessary relids for clauses that involve A Vars or B
Vars but not C Vars, resulting them being placed at higher place than
needed.
Maybe what we need is to add in commute_below_l (assuming it has been
recorded in SpecialJoinInfo) rather than commute_below of outer joins
mentioned within the clause?
Thanks
Richard
From | Date | Subject | |
---|---|---|---|
Next Message | Alexander Lakhin | 2023-02-23 11:00:00 | Re: BUG #17803: Rule "ALSO INSERT ... SELECT ..." fails to substitute default values |
Previous Message | Richard Guo | 2023-02-23 03:29:50 | Re: Clause accidentally pushed down ( Possible bug in Making Vars outer-join aware) |