summaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_agg.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>1999-12-10 07:37:35 +0000
committerTom Lane <tgl@sss.pgh.pa.us>1999-12-10 07:37:35 +0000
commit18c30002863a1a4d2c2f0da6d245f106586bc686 (patch)
treeb417e01845965594239b0f8944e1baf00688b12e /src/backend/parser/parse_agg.c
parentecba5d308ca92d3a4fd0725c200452007217991b (diff)
Teach grammar and parser about aggregate(DISTINCT ...). No implementation
yet, but at least we can give a better error message: regression=> select count(distinct f1) from int4_tbl; ERROR: aggregate(DISTINCT ...) is not implemented yet instead of 'parser: parse error at or near distinct'.
Diffstat (limited to 'src/backend/parser/parse_agg.c')
-rw-r--r--src/backend/parser/parse_agg.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/backend/parser/parse_agg.c b/src/backend/parser/parse_agg.c
index 4e30e60ca65..68280f7f4a0 100644
--- a/src/backend/parser/parse_agg.c
+++ b/src/backend/parser/parse_agg.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.30 1999/12/09 05:58:54 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.31 1999/12/10 07:37:35 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -203,7 +203,8 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
Aggref *
ParseAgg(ParseState *pstate, char *aggname, Oid basetype,
- List *target, int precedence)
+ List *args, bool agg_star, bool agg_distinct,
+ int precedence)
{
HeapTuple theAggTuple;
Form_pg_aggregate aggform;
@@ -242,7 +243,7 @@ ParseAgg(ParseState *pstate, char *aggname, Oid basetype,
if (OidIsValid(xfn1))
{
basetype = aggform->aggbasetype;
- vartype = exprType(lfirst(target));
+ vartype = exprType(lfirst(args));
if ((basetype != vartype)
&& (!IS_BINARY_COMPATIBLE(basetype, vartype)))
{
@@ -261,9 +262,17 @@ ParseAgg(ParseState *pstate, char *aggname, Oid basetype,
aggref->aggname = pstrdup(aggname);
aggref->basetype = aggform->aggbasetype;
aggref->aggtype = fintype;
- aggref->target = lfirst(target);
+ aggref->target = lfirst(args);
aggref->usenulls = usenulls;
+ /*
+ * We should store agg_star and agg_distinct into the Aggref node,
+ * and let downstream processing deal with them. Currently, agg_star
+ * is ignored and agg_distinct is not implemented...
+ */
+ if (agg_distinct)
+ elog(ERROR, "aggregate(DISTINCT ...) is not implemented yet");
+
pstate->p_hasAggs = true;
return aggref;