aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/util/tlist.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/optimizer/util/tlist.c')
-rw-r--r--src/backend/optimizer/util/tlist.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/backend/optimizer/util/tlist.c b/src/backend/optimizer/util/tlist.c
index 8edf44190a4..b4c745b25f3 100644
--- a/src/backend/optimizer/util/tlist.c
+++ b/src/backend/optimizer/util/tlist.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.42 2000/01/26 05:56:40 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.43 2000/01/27 18:11:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -217,15 +217,16 @@ get_expr(TargetEntry *tle)
}
/*
- * get_sortgroupclause_expr
+ * get_sortgroupclause_tle
* Find the targetlist entry matching the given SortClause
- * (or GroupClause) by ressortgroupref, and return its expression.
+ * (or GroupClause) by ressortgroupref, and return it.
*
* Because GroupClause is typedef'd as SortClause, either kind of
* node can be passed without casting.
*/
-Node *
-get_sortgroupclause_expr(SortClause *sortClause, List *targetList)
+TargetEntry *
+get_sortgroupclause_tle(SortClause *sortClause,
+ List *targetList)
{
Index refnumber = sortClause->tleSortGroupRef;
List *l;
@@ -235,9 +236,25 @@ get_sortgroupclause_expr(SortClause *sortClause, List *targetList)
TargetEntry *tle = (TargetEntry *) lfirst(l);
if (tle->resdom->ressortgroupref == refnumber)
- return tle->expr;
+ return tle;
}
- elog(ERROR, "get_sortgroupclause_expr: ORDER/GROUP BY expression not found in targetlist");
+ elog(ERROR, "get_sortgroupclause_tle: ORDER/GROUP BY expression not found in targetlist");
return NULL; /* keep compiler quiet */
}
+
+/*
+ * get_sortgroupclause_expr
+ * Find the targetlist entry matching the given SortClause
+ * (or GroupClause) by ressortgroupref, and return its expression.
+ *
+ * Because GroupClause is typedef'd as SortClause, either kind of
+ * node can be passed without casting.
+ */
+Node *
+get_sortgroupclause_expr(SortClause *sortClause, List *targetList)
+{
+ TargetEntry *tle = get_sortgroupclause_tle(sortClause, targetList);
+
+ return tle->expr;
+}