Re: pgsql: Avoid mislabeling of lateral references when pulling up a subque

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Avoid mislabeling of lateral references when pulling up a subque
Date: 2024-11-30 03:25:02
Message-ID: 824291.1732937102@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Richard Guo <guofenglinux(at)gmail(dot)com> writes:
> This patch can also simplify my other patch, which is to avoid
> unnecessary wrapping for plain Vars/PHVs. We can check the new
> nullingrel_info to see if the nullingrels of the subquery RTE are a
> subset of the nullingrels of the lateral referenced rel, to determine
> if the referenced rel is under the same lowest nulling outer join.
> And this eliminates the need to introduce lowest_nullable_side.

Right, because that's more or less the same problem. Or indeed
it's exactly the same problem, we're just making fast paths for
the easiest cases.

Another thought: the reason I made get_nullingrels return a new
struct rather than tying it directly to filling some fields in
pullup_replace_vars_context was that I think we might want to
reconsider where to call it from. Perhaps it'd be useful to
have the info during is_simple_subquery, for example.

regards, tom lane

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2024-11-30 07:44:47 pgsql: doc: Fix typo
Previous Message Richard Guo 2024-11-30 03:09:18 Re: pgsql: Avoid mislabeling of lateral references when pulling up a subque