pgsql: Fix failure to mark all aggregates with appropriate transtype.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix failure to mark all aggregates with appropriate transtype.
Date: 2016-07-02 17:23:28
Message-ID: E1bJOdc-0003ga-Qt@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(dot)GD3165(at)huehner(dot)biz>

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/420c1661630c96ad10f58ca967d5f561bb404cf9

Modified Files
--------------
src/backend/optimizer/plan/planner.c | 54 ++++++++++++++++++++++--------------
src/test/regress/expected/limit.out | 24 ++++++++++++++++
src/test/regress/sql/limit.sql | 8 ++++++
3 files changed, 65 insertions(+), 21 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Christoph Berg 2016-07-02 17:24:20 Re: pgsql: doc: mention dependency on collation libraries
Previous Message Bruce Momjian 2016-07-02 17:22:48 Re: pgsql: doc: mention dependency on collation libraries