Return-Path: mao
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA01629; Tue, 1 Sep 92 13:03:58 -0700
Message-Id: <9209012003.AA01629@postgres.Berkeley.EDU>
From: <mao@postgres.berkeley.edu>
Subject: Re: What built-in functions are there?
To: postgres@postgres.berkeley.edu
Sender: pg_adm@postgres.berkeley.edu
In-Reply-To: Your message of Tue, 01 Sep 92 12:54:26 PST.
             <9209011954.AA01462@postgres.Berkeley.EDU> 
Date: Tue, 01 Sep 92 13:03:11 PDT

In message <9209011954.AA01462@postgres.Berkeley.EDU> you write:

> How can I find the list of available built-in functions?
>
> In particular, I want to extract max(rel.attribute).

you want to use an aggregate, not a function.  functions take a single
argument list and return a single value.  an aggregate is called with
a bunch of values iteratively, and returns a single value at the end.

the syntax for the operation you want is

    retrieve (max = int2max{rel.attribute})

if rel.attribute is an int2.  the set of available attributes is listed
in pg_attribute; you can say

    retrieve (name = a.aggname, argtype = t1.typname, rettype = t2.typname)
	    from a in pg_aggregate, t1 in pg_type, t2 in pg_type
	    where a.inttype = t1.oid and a.fintype = t2.oid

to list all defined aggregates, the argument type they expect, and the
value of the type they return.
					mike olson
					project sequoia 2000
					uc berkeley
					mao@cs.berkeley.edu
