Following query works fine on PG14, but produce error "WindowFunc not found in subplan target lists" on PG15:
select 1 from ( select count(case t1.a when 1 then 1 else null end) over (partition by t2.b) c from (select 1 a) t1, (select 1 b) t2 ) t where t.c = 1
Thanks for the report! I can reproduce this issue.
The WindowFunc within runCondition comes from the query's targetList, before we pull up subquery 't1'. Then when it comes to pulling up subquery 't1', we perform pullup variable replacement for the query's targetList but not for runCondition in the query's windowClause. I believe that's how this error is triggered.