Give pull_var_clause() reject/recurse/return behavior for WindowFuncs too.
All along, this function should have treated WindowFuncs in a manner
similar to Aggrefs, ie with an option whether or not to recurse into them.
By not considering the case, it was always recursing, which is OK for most
callers (although I suspect that the case in prepare_sort_from_pathkeys
might represent a bug). But now we need return-without-recursing behavior
as well. There are also more than a few callers that should never see a
WindowFunc, and now we'll get some error checking on that.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/c82c92b111b7b636e80f8a432de10c62011b35b6
Modified Files
--------------
src/backend/optimizer/path/equivclass.c | 1 +
src/backend/optimizer/plan/createplan.c | 4 +++-
src/backend/optimizer/plan/initsplan.c | 5 ++++-
src/backend/optimizer/plan/planner.c | 9 ++++++---
src/backend/optimizer/prep/preptlist.c | 1 +
src/backend/optimizer/util/placeholder.c | 2 ++
src/backend/optimizer/util/var.c | 25 +++++++++++++++++++++++++
src/backend/utils/adt/selfuncs.c | 1 +
src/include/optimizer/var.h | 6 ++++--
9 files changed, 47 insertions(+), 7 deletions(-)