Re: wrong query result due to wang plan

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: tender wang <tndrwang(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: wrong query result due to wang plan
Date: 2023-02-16 10:14:40
Message-ID: CAMbWs49De1Wsk3QPKK9BQW_H0Pk2LMz7XvX8aO=MSq+FNvazdw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 16, 2023 at 5:50 PM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:

> It seems we still need to check whether a variable-free qual comes from
> somewhere that is below the nullable side of an outer join before we
> decide that it can be evaluated at join domain level, just like we did
> before. So I wonder if we can add a 'below_outer_join' flag in
> JoinTreeItem, fill its value during deconstruct_recurse, and check it in
> distribute_qual_to_rels() like
>
> /* eval at join domain level if not below outer join */
> - relids = bms_copy(jtitem->jdomain->jd_relids);
> + relids = jtitem->below_outer_join ?
> + bms_copy(qualscope) : bms_copy(jtitem->jdomain->jd_relids);
>

To be concrete, I mean something like attached.

Thanks
Richard

Attachment Content-Type Size
v1-0001-Fix-variable-free-clause-distribution.patch application/octet-stream 5.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Laurenz Albe 2023-02-16 10:32:16 Re: Move defaults toward ICU in 16?
Previous Message Drouvot, Bertrand 2023-02-16 09:55:32 Re: Normalization of utility queries in pg_stat_statements