* statext_is_compatible_clause_internal is not on board with offsetting the attnums.
Correct. Good catch! Fix this in v2 patch.
* Neither is this check for a whole-row reference (line 1628, in HEAD):
if (bms_is_member(InvalidAttrNumber, clause_attnums))
Actually this has been fixed in my v1 patch [1].
* Although the coverage report claims this code is exercised, the fact that nothing failed when you made only a partial fix says it's not exercised well enough.
That's true. We need to provide a better test case to cover this.
* The comments for statext_is_compatible_clause suck. If they'd defined what the arguments are, perhaps this mess would have been prevented. For extra credit, it'd be really nice to define what "is compatible" means. I'd sure not have thought that that would include permissions checks.