pgsql: Fix planner failure in some cases of sorting by an aggregate.

2021-04-20 Thread Tom Lane
Fix planner failure in some cases of sorting by an aggregate. An oversight introduced by the incremental-sort patches caused "could not find pathkey item to sort" errors in some situations where a sort key involves an aggregate or window function. The basic problem here is that find_em_expr_usabl

pgsql: Fix planner failure in some cases of sorting by an aggregate.

2021-04-20 Thread Tom Lane
Fix planner failure in some cases of sorting by an aggregate. An oversight introduced by the incremental-sort patches caused "could not find pathkey item to sort" errors in some situations where a sort key involves an aggregate or window function. The basic problem here is that find_em_expr_usabl