• T
    Fix case of window function + aggregate + GROUP BY expression. · a2099360
    Tom Lane 提交于
    In commit 1bc16a94 I added a minor
    optimization to drop the component variables of a GROUP BY expression from
    the target list computed at the aggregation level of a query, if those Vars
    weren't referenced elsewhere in the tlist.  However, I overlooked that the
    window-function planning code would deconstruct such expressions and thus
    need to have access to their component variables.  Fix it to not do that.
    
    While at it, I removed the distinction between volatile and nonvolatile
    window partition/order expressions: the code now computes all of them
    at the aggregation level.  This saves a relatively expensive check for
    volatility, and it's unclear that the resulting plan isn't better anyway.
    
    Per bug #7535 from Louis-David Mitterrand.  Back-patch to 9.2.
    a2099360
planner.c 107.8 KB