diff options
Diffstat (limited to 'src/include/nodes/primnodes.h')
-rw-r--r-- | src/include/nodes/primnodes.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h index 0320e231553..58d286ab9c8 100644 --- a/src/include/nodes/primnodes.h +++ b/src/include/nodes/primnodes.h @@ -10,7 +10,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/primnodes.h,v 1.151 2009/10/08 02:39:24 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/primnodes.h,v 1.152 2009/12/15 17:57:47 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -209,16 +209,29 @@ typedef struct Param /* * Aggref + * + * The aggregate's args list is a targetlist, ie, a list of TargetEntry nodes + * (before Postgres 8.5 it was just bare expressions). The non-resjunk TLEs + * represent the aggregate's regular arguments (if any) and resjunk TLEs can + * be added at the end to represent ORDER BY expressions that are not also + * arguments. As in a top-level Query, the TLEs can be marked with + * ressortgroupref indexes to let them be referenced by SortGroupClause + * entries in the aggorder and/or aggdistinct lists. This represents ORDER BY + * and DISTINCT operations to be applied to the aggregate input rows before + * they are passed to the transition function. The grammar only allows a + * simple "DISTINCT" specifier for the arguments, but we use the full + * query-level representation to allow more code sharing. */ typedef struct Aggref { Expr xpr; Oid aggfnoid; /* pg_proc Oid of the aggregate */ Oid aggtype; /* type Oid of result of the aggregate */ - List *args; /* arguments to the aggregate */ - Index agglevelsup; /* > 0 if agg belongs to outer query */ + List *args; /* arguments and sort expressions */ + List *aggorder; /* ORDER BY (list of SortGroupClause) */ + List *aggdistinct; /* DISTINCT (list of SortGroupClause) */ bool aggstar; /* TRUE if argument list was really '*' */ - bool aggdistinct; /* TRUE if it's agg(DISTINCT ...) */ + Index agglevelsup; /* > 0 if agg belongs to outer query */ int location; /* token location, or -1 if unknown */ } Aggref; |