Hi Shihao, > So it is an old bug with a new way in.
Confirmed, and the split is clean when measured on the current tip of each branch: the LEFT JOIN wrong results are there from 14, while the NOT EXISTS (anti join) case appears only from 19, where 0da29e4cb16 let anti joins use Memoize -- matching your "regression from 18". 0001 fixes it and make check passes on all of 14 through 19 and master. I also checked it holds across several nondeterministic collations, a two-column key, a varchar outer column, a non-Var outer expression, a partitioned inner rel, and LEFT JOIN LATERAL (already right, since lateral_vars go into binary mode). One caveat for the back branches: on 14-16 the new block must go before the lappend into *param_exprs -- there is no list_member test there. patch/git apply with fuzz instead places it after, which still compiles and passes make check but leaves the bug unfixed (I measured that on 16). A mechanical back-patch would look fine and fix nothing; I can post the by-hand hunks for 14-16 if that helps. Manu
