mirror of
https://github.com/postgres/postgres.git
synced 2025-06-29 10:41:53 +03:00
Extend the set of frame options supported for window functions.
This patch allows the frame to start from CURRENT ROW (in either RANGE or ROWS mode), and it also adds support for ROWS n PRECEDING and ROWS n FOLLOWING start and end points. (RANGE value PRECEDING/FOLLOWING isn't there yet --- the grammar works, but that's all.) Hitoshi Harada, reviewed by Pavel Stehule
This commit is contained in:
@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/plan/setrefs.c,v 1.157 2010/01/15 22:36:32 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/plan/setrefs.c,v 1.158 2010/02/12 17:33:20 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -466,10 +466,26 @@ set_plan_refs(PlannerGlobal *glob, Plan *plan, int rtoffset)
|
||||
}
|
||||
break;
|
||||
case T_Agg:
|
||||
case T_WindowAgg:
|
||||
case T_Group:
|
||||
set_upper_references(glob, plan, rtoffset);
|
||||
break;
|
||||
case T_WindowAgg:
|
||||
{
|
||||
WindowAgg *wplan = (WindowAgg *) plan;
|
||||
|
||||
set_upper_references(glob, plan, rtoffset);
|
||||
|
||||
/*
|
||||
* Like Limit node limit/offset expressions, WindowAgg has
|
||||
* frame offset expressions, which cannot contain subplan
|
||||
* variable refs, so fix_scan_expr works for them.
|
||||
*/
|
||||
wplan->startOffset =
|
||||
fix_scan_expr(glob, wplan->startOffset, rtoffset);
|
||||
wplan->endOffset =
|
||||
fix_scan_expr(glob, wplan->endOffset, rtoffset);
|
||||
}
|
||||
break;
|
||||
case T_Result:
|
||||
{
|
||||
Result *splan = (Result *) plan;
|
||||
|
Reference in New Issue
Block a user