Since upper-level WindowAggs cannot reference values calculated in some lower-level WindowAgg, why can't we just NULLify the pointers instead? See attached.
Verified the problem is fixed with this patch. I'm not familiar with the WindowAgg execution codes. As far as I understand, this patch works because we set ecxt_aggnulls to true, making it a NULL value. And the top-level WindowAgg node's "Filter" is strict so that it can filter out all the tuples that don't match the intermediate WindowAgg node's run condition. So I find the comments about "WindowAggs above us cannot reference the result of another WindowAgg" confusing. But maybe I'm missing something.