diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-04-09 20:35:55 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-04-09 20:35:55 +0000 |
commit | f2d70d32ebd6c38d4fe93c1a684f5f29e5e76938 (patch) | |
tree | 5d041018177cdf6e9ca3ef0cc2eafac580a5bb0b /src/backend/parser/parse_target.c | |
parent | c419c224142eb4bbf6e9a47d2d3626f212fda0fc (diff) | |
download | postgresql-f2d70d32ebd6c38d4fe93c1a684f5f29e5e76938.tar.gz postgresql-f2d70d32ebd6c38d4fe93c1a684f5f29e5e76938.zip |
Functions live in namespaces. Qualified function names work, eg
SELECT schema1.func2(...). Aggregate names can be qualified at the
syntactic level, but the qualification is ignored for the moment.
Diffstat (limited to 'src/backend/parser/parse_target.c')
-rw-r--r-- | src/backend/parser/parse_target.c | 47 |
1 files changed, 13 insertions, 34 deletions
diff --git a/src/backend/parser/parse_target.c b/src/backend/parser/parse_target.c index e8e82a45c3b..83c53de5d1d 100644 --- a/src/backend/parser/parse_target.c +++ b/src/backend/parser/parse_target.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.82 2002/04/05 11:56:53 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.83 2002/04/09 20:35:53 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -498,48 +498,34 @@ FigureColnameInternal(Node *node, char **name) return 2; case T_ColumnRef: { - List *fields = ((ColumnRef *) node)->fields; + char *cname = strVal(llast(((ColumnRef *) node)->fields)); - while (lnext(fields) != NIL) - fields = lnext(fields); - if (strcmp(strVal(lfirst(fields)), "*") != 0) + if (strcmp(cname, "*") != 0) { - *name = strVal(lfirst(fields)); + *name = cname; return 2; } } break; case T_ExprFieldSelect: { - List *fields = ((ExprFieldSelect *) node)->fields; + char *fname = strVal(llast(((ExprFieldSelect *) node)->fields)); - if (fields) + if (strcmp(fname, "*") != 0) { - while (lnext(fields) != NIL) - fields = lnext(fields); - if (strcmp(strVal(lfirst(fields)), "*") != 0) - { - *name = strVal(lfirst(fields)); - return 2; - } + *name = fname; + return 2; } } break; case T_FuncCall: - *name = ((FuncCall *) node)->funcname; + *name = strVal(llast(((FuncCall *) node)->funcname)); return 2; case T_A_Const: if (((A_Const *) node)->typename != NULL) { - List *names = ((A_Const *) node)->typename->names; - - if (names != NIL) - { - while (lnext(names) != NIL) - names = lnext(names); - *name = strVal(lfirst(names)); - return 1; - } + *name = strVal(llast(((A_Const *) node)->typename->names)); + return 1; } break; case T_TypeCast: @@ -549,15 +535,8 @@ FigureColnameInternal(Node *node, char **name) { if (((TypeCast *) node)->typename != NULL) { - List *names = ((TypeCast *) node)->typename->names; - - if (names != NIL) - { - while (lnext(names) != NIL) - names = lnext(names); - *name = strVal(lfirst(names)); - return 1; - } + *name = strVal(llast(((TypeCast *) node)->typename->names)); + return 1; } } break; |