]> granicus.if.org Git - postgresql/commit
Fix failure to mark all aggregates with appropriate transtype.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 2 Jul 2016 17:23:02 +0000 (13:23 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 2 Jul 2016 17:23:12 +0000 (13:23 -0400)
commit420c1661630c96ad10f58ca967d5f561bb404cf9
tree06a90e6edc366104467a2837cf36f7cb43b7df51
parentb54f7a9ac9646845138f6851fdf3097e22daa383
Fix failure to mark all aggregates with appropriate transtype.

In commit 915b703e1 I gave get_agg_clause_costs() the responsibility of
marking Aggref nodes with the appropriate aggtranstype.  I failed to notice
that where it was being called from, it might see only a subset of the
Aggref nodes that were in the original targetlist.  Specifically, if there
are duplicate aggregate calls in the tlist, either make_sort_input_target
or make_window_input_target might put just a single instance into the
grouping_target, and then only that instance would get marked.  Fix by
moving the call back into grouping_planner(), before we start building
assorted PathTargets from the query tlist.  Per report from Stefan Huehner.

Report: <20160702131056.GD3165@huehner.biz>
src/backend/optimizer/plan/planner.c
src/test/regress/expected/limit.out
src/test/regress/sql/limit.sql