diff options
author | Neil Conway <neilc@samurai.com> | 2004-05-26 04:41:50 +0000 |
---|---|---|
committer | Neil Conway <neilc@samurai.com> | 2004-05-26 04:41:50 +0000 |
commit | d0b4399d81f39decccb23fa38f772b71b51bf96a (patch) | |
tree | 71d3b737f5d93f6c3984412a4910b5810156c5ca /src/backend/parser/parse_agg.c | |
parent | 18d0d105635fbc7e476063e662b449f296953a04 (diff) | |
download | postgresql-d0b4399d81f39decccb23fa38f772b71b51bf96a.tar.gz postgresql-d0b4399d81f39decccb23fa38f772b71b51bf96a.zip |
Reimplement the linked list data structure used throughout the backend.
In the past, we used a 'Lispy' linked list implementation: a "list" was
merely a pointer to the head node of the list. The problem with that
design is that it makes lappend() and length() linear time. This patch
fixes that problem (and others) by maintaining a count of the list
length and a pointer to the tail node along with each head node pointer.
A "list" is now a pointer to a structure containing some meta-data
about the list; the head and tail pointers in that structure refer
to ListCell structures that maintain the actual linked list of nodes.
The function names of the list API have also been changed to, I hope,
be more logically consistent. By default, the old function names are
still available; they will be disabled-by-default once the rest of
the tree has been updated to use the new API names.
Diffstat (limited to 'src/backend/parser/parse_agg.c')
-rw-r--r-- | src/backend/parser/parse_agg.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/backend/parser/parse_agg.c b/src/backend/parser/parse_agg.c index 6f85595610d..e9c73ee946a 100644 --- a/src/backend/parser/parse_agg.c +++ b/src/backend/parser/parse_agg.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_agg.c,v 1.61 2004/01/28 07:46:44 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_agg.c,v 1.62 2004/05/26 04:41:29 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -99,7 +99,7 @@ parseCheckAggregates(ParseState *pstate, Query *qry) { List *groupClauses = NIL; bool have_non_var_grouping; - List *lst; + ListCell *l; bool hasJoinRTEs; Node *clause; @@ -129,9 +129,9 @@ parseCheckAggregates(ParseState *pstate, Query *qry) * While we are at it, build a list of the acceptable GROUP BY * expressions for use by check_ungrouped_columns(). */ - foreach(lst, qry->groupClause) + foreach(l, qry->groupClause) { - GroupClause *grpcl = (GroupClause *) lfirst(lst); + GroupClause *grpcl = (GroupClause *) lfirst(l); Node *expr; expr = get_sortgroupclause_expr(grpcl, qry->targetList); @@ -151,9 +151,9 @@ parseCheckAggregates(ParseState *pstate, Query *qry) * no rangetable entries are RTE_JOIN kind. */ hasJoinRTEs = false; - foreach(lst, pstate->p_rtable) + foreach(l, pstate->p_rtable) { - RangeTblEntry *rte = (RangeTblEntry *) lfirst(lst); + RangeTblEntry *rte = (RangeTblEntry *) lfirst(l); if (rte->rtekind == RTE_JOIN) { @@ -172,9 +172,9 @@ parseCheckAggregates(ParseState *pstate, Query *qry) * recursive scans. (Note we have to flatten aliases before this.) */ have_non_var_grouping = false; - foreach(lst, groupClauses) + foreach(l, groupClauses) { - if (!IsA((Node *) lfirst(lst), Var)) + if (!IsA((Node *) lfirst(l), Var)) { have_non_var_grouping = true; break; @@ -236,7 +236,7 @@ static bool check_ungrouped_columns_walker(Node *node, check_ungrouped_columns_context *context) { - List *gl; + ListCell *gl; if (node == NULL) return false; |