Re: Check SubPlan clause for nonnullable rels/Vars - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Check SubPlan clause for nonnullable rels/Vars
Date
Msg-id 1849611.1667420765@sss.pgh.pa.us
Whole thread Raw
In response to Check SubPlan clause for nonnullable rels/Vars  (Richard Guo <guofenglinux@gmail.com>)
Responses Re: Check SubPlan clause for nonnullable rels/Vars
List pgsql-hackers
Richard Guo <guofenglinux@gmail.com> writes:
> While wandering around the codes of reducing outer joins, I noticed that
> when determining which base rels/Vars are forced nonnullable by given
> clause, we don't take SubPlan into consideration. Does anyone happen to
> know what is the concern behind that?

Probably just didn't bother with the case at the time.

> IMO, for SubPlans of type ALL/ANY/ROWCOMPARE, we should be able to find
> additional nonnullable rels/Vars by descending through their testexpr.

I think you can make something of this, but you need to be a lot more
paranoid than this patch is.

* I don't believe you can prove anything from an ALL_SUBLINK SubPlan,
because it will return true if the sub-query returns zero rows, no
matter what the testexpr is.  (Maybe if you could prove the sub-query
does return a row, but I doubt it's worth going there.)

* You need to explicitly check the subLinkType; as written this'll
consider EXPR_SUBLINK and so on.  I'm not really on board with
assuming that nothing bad will happen with sublink types other than
the ones the code is expecting.

* It's not apparent to me that it's okay to pass down "top_level"
rather than "false".  Maybe it's all right, but it could do with
a comment.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: ssl tests aren't concurrency safe due to get_free_port()
Next
From: Daniel Gustafsson
Date:
Subject: Re: pg_basebackup's --gzip switch misbehaves