mirror of
https://github.com/postgres/postgres.git
synced 2025-07-11 10:01:57 +03:00
Teach planner how to propagate pathkeys from sub-SELECTs in FROM up to
the outer query. (The implementation is a bit klugy, but it would take nontrivial restructuring to make it nicer, which this is probably not worth.) This avoids unnecessary sort steps in examples like SELECT foo,count(*) FROM (SELECT ... ORDER BY foo,bar) sub GROUP BY foo which means there is now a reasonable technique for controlling the order of inputs to custom aggregates, even in the grouping case.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.47 2003/02/08 20:20:55 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.48 2003/02/15 20:12:40 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -381,11 +381,11 @@ new_join_tlist(List *tlist,
|
||||
|
||||
foreach(i, tlist)
|
||||
{
|
||||
TargetEntry *xtl = lfirst(i);
|
||||
TargetEntry *tle = lfirst(i);
|
||||
|
||||
resdomno += 1;
|
||||
t_list = lappend(t_list,
|
||||
create_tl_element(get_expr(xtl), resdomno));
|
||||
create_tl_element((Var *) tle->expr, resdomno));
|
||||
}
|
||||
|
||||
return t_list;
|
||||
|
Reference in New Issue
Block a user