Thread: pgsql/src backend/catalog/index.c backend/pars ...

pgsql/src backend/catalog/index.c backend/pars ...

From
Bruce Momjian - CVS
Date:
CVSROOT:    /home/projects/pgsql/cvsroot
Module name:    pgsql
Changes by:    momjian@hub.org    01/05/18 18:35:51

Modified files:
    src/backend/catalog: index.c
    src/backend/parser: parse_expr.c parse_func.c
    src/backend/utils/adt: format_type.c
    src/include/parser: parse_func.h

Log message:
    Rename ParseFuncOrColumn() to ParseColumnOrFunc().


Re: pgsql/src backend/catalog/index.c backend/pars ...

From
Bruce Momjian
Date:
> Bruce Momjian - CVS <momjian@hub.org> writes:
> >     Rename ParseFuncOrColumn() to ParseColumnOrFunc().
>
> This is an improvement?
>
> Considering that the function is primarily concerned with parsing
> function calls, I'd call this a net decrease in intelligibility.

Here is my comment added to the top of the code.  Is it correct?

/*
 *     parse function
 *     This code is confusing code because the database can accept
 *  relation.column, column.function, or relation.column.function.
 *  It can also be called as func(col) or func(col,col).
 *
 *    Funcname is the first parameter, and fargs are the rest.
 */
ParseColumnOrFunc(ParseState *pstate, char *funcname, List *fargs,
                  bool agg_star, bool agg_distinct,
                  int precedence)

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: pgsql/src backend/catalog/index.c backend/pars ...

From
Tom Lane
Date:
Bruce Momjian - CVS <momjian@hub.org> writes:
>     Rename ParseFuncOrColumn() to ParseColumnOrFunc().

This is an improvement?

Considering that the function is primarily concerned with parsing
function calls, I'd call this a net decrease in intelligibility.

            regards, tom lane

Re: pgsql/src backend/catalog/index.c backend/pars ...

From
Bruce Momjian
Date:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Here is my comment added to the top of the code.  Is it correct?
>
> >  *     This code is confusing code because the database can accept
> >  *  relation.column, column.function, or relation.column.function.
> >  *  It can also be called as func(col) or func(col,col).
>
> That's correct.
>
> >  *    Funcname is the first parameter, and fargs are the rest.
>
> That's not, or at least it doesn't apply to the dot-notation cases.
> func(col) and col.func are equivalent notations and look the same
> by the time they get to this routine.

Oh, got it.  I will put the old name back and update the comment.


--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: pgsql/src backend/catalog/index.c backend/pars ...

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Here is my comment added to the top of the code.  Is it correct?

>  *     This code is confusing code because the database can accept
>  *  relation.column, column.function, or relation.column.function.
>  *  It can also be called as func(col) or func(col,col).

That's correct.

>  *    Funcname is the first parameter, and fargs are the rest.

That's not, or at least it doesn't apply to the dot-notation cases.
func(col) and col.func are equivalent notations and look the same
by the time they get to this routine.

            regards, tom lane