On Wed, Aug 28, 2024 at 11:30 AM Richard Guo <guofengli...@gmail.com> wrote: > On Wed, Aug 28, 2024 at 5:52 AM Tom Lane <t...@sss.pgh.pa.us> wrote: > > I realized that actually we do have the mechanism for making that > > work: we could apply add_nulling_relids to the expression, if it > > meets those same conditions. > > I think this should work, as long as we apply add_nulling_relids only > to Vars/PHVs that belong to the subquery in this case, because only > those Vars/PHVs would be nulled by the outer joins contained in the > nullingrels.
To be more concrete, I know theoretically it is the whole expression that is nullable by the outer joins, not its individual vars. But in this case if the contained vars (that belong to the subquery) become NULL, the whole expression would be NULL too, because it does not contain any non-strict constructs. That's why I think this approach should work. Thanks Richard