]> granicus.if.org Git - postgresql/commitdiff
New comment. This func/column things has always confused me.
authorBruce Momjian <bruce@momjian.us>
Sat, 19 May 2001 00:33:20 +0000 (00:33 +0000)
committerBruce Momjian <bruce@momjian.us>
Sat, 19 May 2001 00:33:20 +0000 (00:33 +0000)
/*
 *  parse function
 *  This code is confusing because the database can accept
 *  relation.column, column.function, or relation.column.function.
 *  In these cases, funcname is the last parameter, and fargs are
 *  the rest.
 *
 *  It can also be called as func(col) or func(col,col).
 *  In this case, Funcname is the part before parens, and fargs
 *  are the part in parens.
 *
 */
Node *
ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
                  bool agg_star, bool agg_distinct,
                  int precedence)

src/backend/parser/parse_expr.c
src/backend/parser/parse_func.c
src/include/parser/parse_func.h

index 786be985200b84dc0d67fe1c891d2cc43f35053b..08a2f5f20351350f0aa964b7a9328e95b81ea07d 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.94 2001/05/18 22:35:50 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.95 2001/05/19 00:33:20 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -173,7 +173,7 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
                                                                                                                          a->lexpr,
                                                                                                                          precedence);
 
-                                                       result = ParseColumnOrFunc(pstate,
+                                                       result = ParseFuncOrColumn(pstate,
                                                                                                           "nullvalue",
                                                                                                           makeList1(lexpr),
                                                                                                           false, false,
@@ -186,7 +186,7 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
                                                                                                                          a->lexpr,
                                                                                                                          precedence);
 
-                                                       result = ParseColumnOrFunc(pstate,
+                                                       result = ParseFuncOrColumn(pstate,
                                                                                                           "nonnullvalue",
                                                                                                           makeList1(lexpr),
                                                                                                           false, false,
@@ -273,7 +273,7 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
                                        lfirst(args) = transformExpr(pstate,
                                                                                                 (Node *) lfirst(args),
                                                                                                 precedence);
-                               result = ParseColumnOrFunc(pstate,
+                               result = ParseFuncOrColumn(pstate,
                                                                                   fn->funcname,
                                                                                   fn->args,
                                                                                   fn->agg_star,
index 2d4ad1eeb88ada838638d2251ba08613615a8382..b231058726078d21d68fba3f4b3426d1c0000a41 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.105 2001/05/18 22:54:23 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.106 2001/05/19 00:33:20 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -75,7 +75,7 @@ ParseNestedFuncOrColumn(ParseState *pstate, Attr *attr, int precedence)
                                                                                                  (Node *) attr->paramNo,
                                                                                                        EXPR_RELATION_FIRST);
 
-               retval = ParseColumnOrFunc(pstate, strVal(lfirst(attr->attrs)),
+               retval = ParseFuncOrColumn(pstate, strVal(lfirst(attr->attrs)),
                                                                   makeList1(param),
                                                                   false, false,
                                                                   precedence);
@@ -86,7 +86,7 @@ ParseNestedFuncOrColumn(ParseState *pstate, Attr *attr, int precedence)
 
                ident->name = attr->relname;
                ident->isRel = TRUE;
-               retval = ParseColumnOrFunc(pstate, strVal(lfirst(attr->attrs)),
+               retval = ParseFuncOrColumn(pstate, strVal(lfirst(attr->attrs)),
                                                                   makeList1(ident),
                                                                   false, false,
                                                                   precedence);
@@ -95,7 +95,7 @@ ParseNestedFuncOrColumn(ParseState *pstate, Attr *attr, int precedence)
        /* Do more attributes follow this one? */
        foreach(mutator_iter, lnext(attr->attrs))
        {
-               retval = ParseColumnOrFunc(pstate, strVal(lfirst(mutator_iter)),
+               retval = ParseFuncOrColumn(pstate, strVal(lfirst(mutator_iter)),
                                                                   makeList1(retval),
                                                                   false, false,
                                                                   precedence);
@@ -236,14 +236,18 @@ agg_select_candidate(Oid typeid, CandidateList candidates)
 
 /*
  *     parse function
- *     This code is confusing code because the database can accept
+ *     This code is confusing because the database can accept
  *  relation.column, column.function, or relation.column.function.
+ *     In these cases, funcname is the last parameter, and fargs are
+ *  the rest.
+ *
  *  It can also be called as func(col) or func(col,col).
+ *  In this case, Funcname is the part before parens, and fargs
+ *  are the part in parens.
  *
- *     Funcname is the first parameter, and fargs are the rest.
  */
 Node *
-ParseColumnOrFunc(ParseState *pstate, char *funcname, List *fargs,
+ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
                                  bool agg_star, bool agg_distinct,
                                  int precedence)
 {
@@ -491,7 +495,7 @@ ParseColumnOrFunc(ParseState *pstate, char *funcname, List *fargs,
                        }
                        else
                        {
-                               elog(ERROR, "ParseColumnOrFunc: unexpected node type %d",
+                               elog(ERROR, "ParseFuncOrColumn: unexpected node type %d",
                                         nodeTag(rteorjoin));
                                rte = NULL;             /* keep compiler quiet */
                        }
@@ -1540,7 +1544,7 @@ make_arguments(ParseState *pstate,
 /*
  ** setup_field_select
  **            Build a FieldSelect node that says which attribute to project to.
- **            This routine is called by ParseColumnOrFunc() when we have found
+ **            This routine is called by ParseFuncOrColumn() when we have found
  **            a projection on a function result or parameter.
  */
 static FieldSelect *
index 5ff0dd510cdf98345cb69fde846ccebabec537ca..105781b96c3984e324b92e1dcbf006a934172542 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parse_func.h,v 1.30 2001/05/18 22:35:51 momjian Exp $
+ * $Id: parse_func.h,v 1.31 2001/05/19 00:33:20 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -40,7 +40,7 @@ typedef struct _CandidateList
 
 extern Node *ParseNestedFuncOrColumn(ParseState *pstate, Attr *attr,
                                                int precedence);
-extern Node *ParseColumnOrFunc(ParseState *pstate,
+extern Node *ParseFuncOrColumn(ParseState *pstate,
                                  char *funcname, List *fargs,
                                  bool agg_star, bool agg_distinct,
                                  int precedence);