Richard Guo <[email protected]> 于2026年1月27日周二 15:10写道: > > On Tue, Jan 27, 2026 at 11:32 AM Tender Wang <[email protected]> wrote: > > Interesting optimization. I look through the v2-0001 patch. In the > > commit message, it says: > > ... > > This patch extends the optimization to cases where inputs are non-constant > > but > > proven to be non-nullable. Specifically, "x IS DISTINCT FROM NULL" > > folds to constant TRUE if "x" is known to be non-nullable. > > ... > > > > But I found that the case "x IS DISTINCT FROM NULL" is converted to > > NullTest in transformAExprDistinct(). > > It will be optimized in the "case T_NullTest:" not by this patch. > > Well, while it's true that the parser would do this transformation for > "literal" NULLs, here we are talking more about "calculated" NULLs. > Consider "not_null_col IS DISTINCT FROM (1 + NULL)".
Got it. I looked through the v2-0002 patch. LGTM. -- Thanks, Tender Wang
