Hi Haibo, I reviewed v1 and it looks correct to me.
Both of your queries give the right rows on master and 19, and the new tests fail without the fix. I asked Claude to try about 80 more queries, in HAVING, ORDER BY, window functions, sublinks and LATERAL. All give the rows I expect. The code applies to 18 too, only two hunks of expected output differ. The file sent as v2 is not the same patch though. It does not apply to master, its test hunks need a gs_users test that is not in the tree. The code is different, the NOT NULL test is gone, and it has no Reported-by line. Was it the wrong file? The first query is right on 18 and wrong on 19, so I hope this can go in before 19 is out. Thanks, Shihao
