Hi Matheus, Thanks for v2 and for the back-branch patches.
I read the patches. v2 covers the points I raised: - The WHERE case is now in generated_virtual.sql (gtest20e), with the EXPLAIN of the Filter and the count(*) result, plus the CHECK constraint case. - The ALTER TYPE ... DROP ATTRIBUTE case and the stored view case are in rowtypes.sql, with the EXPLAIN output showing "(x IS NOT NULL) AND (z IS NOT NULL)". - The back-branch patches match what you describe: REL_18 without expr_is_nonnullable(), REL_17 and older with TupleDescAttr() and only the rowtypes.sql tests, and REL_14 with regular tables instead of temp tables. I also tested them: - v2 applies to current master (8d87367b39e), and make check passes (all 243 tests). - With the v2 tests but the old clauses.c, generated_virtual and rowtypes fail (2 of 243), so the new tests catch the bug. - The WHERE case from the report (count(*) ... WHERE t IS NOT NULL) returns 0 on master and 2 with v2. - The back-branch patches apply and make check passes on REL_18_STABLE (235 tests), REL_17_STABLE (229) and REL_14_STABLE (220). I did not test REL_15 and REL_16. I have no remaining concerns about the code. One small optional idea: the view test only checks the view that has the IS NOT NULL inside it. It could also check a view that stores only the ROW(...)::type and applies IS NOT NULL outside it, but I think the current test is enough. Thanks, João
