pgsql: Trim ORDER BY/DISTINCT aggregate pathkeys in gather_grouping_pat

From: David Rowley <drowley(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Trim ORDER BY/DISTINCT aggregate pathkeys in gather_grouping_pat
Date: 2024-03-14 22:55:43
Message-ID: E1rktzD-003p2i-F8@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Trim ORDER BY/DISTINCT aggregate pathkeys in gather_grouping_paths

Similar to d8a295389, trim off any PathKeys which are for ORDER BY /
DISTINCT aggregate functions from the PathKey List for the Gather Merge
paths created by gather_grouping_paths(). These additional PathKeys are
not valid to use after grouping has taken place as these PathKeys belong
to columns which are inputs to an aggregate function and, therefore are
unavailable after aggregation.

Reported-by: Alexander Lakhin
Discussion: https://postgr.es/m/cf63174c-8c89-3953-cb49-48f41f74941a@gmail.com
Backpatch-through: 16, where 1349d2790 was added

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4169850f0b6fc98a5f28d2b0ca4c3a4c1ecf4553

Modified Files
--------------
src/backend/optimizer/plan/planner.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message David Rowley 2024-03-14 22:56:08 pgsql: Trim ORDER BY/DISTINCT aggregate pathkeys in gather_grouping_pat
Previous Message Daniel Gustafsson 2024-03-14 22:41:09 pgsql: Login event trigger documentation wordsmithing