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/nodes/list.c | |
parent | c419c224142eb4bbf6e9a47d2d3626f212fda0fc (diff) |
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/nodes/list.c')
-rw-r--r-- | src/backend/nodes/list.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/src/backend/nodes/list.c b/src/backend/nodes/list.c index 9b588150fda..a61991f38fa 100644 --- a/src/backend/nodes/list.c +++ b/src/backend/nodes/list.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.39 2001/03/22 03:59:32 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.40 2002/04/09 20:35:50 tgl Exp $ * * NOTES * XXX a few of the following functions are duplicated to handle @@ -234,6 +234,36 @@ length(List *l) } /* + * llast + * + * Get the last element of l ... error if empty list + */ +void * +llast(List *l) +{ + if (l == NIL) + elog(ERROR, "llast: empty list"); + while (lnext(l) != NIL) + l = lnext(l); + return lfirst(l); +} + +/* + * llasti + * + * As above, but for integer lists + */ +int +llasti(List *l) +{ + if (l == NIL) + elog(ERROR, "llasti: empty list"); + while (lnext(l) != NIL) + l = lnext(l); + return lfirsti(l); +} + +/* * freeList * * Free the List nodes of a list |