sorry for the late response. I will try out your changes from the view of a user in mid-June. However, I can't do a trustworthy code review as I'm not an experienced postgre-hacker (yet).
Thanks, that sort of review will be a great start.
I've attached an updated patch as it seems there's been a change that removes redundant sorts which was breaking one of the regression tests in v0.2 of the patch.
+EXPLAIN (COSTS OFF)
+SELECT depname,depsalary FROM (SELECT depname,
+ sum(salary) OVER (PARTITION BY depname) depsalary,
+ rank() OVER (ORDER BY enroll_date) emprank
+ FROM empsalary) emp
+WHERE depname = 'sales';
This used to produced a plan which included a sort by enroll_date, but this is no longer the case. I've updated the expected results to remove the extra sort from the explain output