On Mon, Mar 14, 2005 at 00:35:32 -0500,
  Greg Stark <[EMAIL PROTECTED]> wrote:
> 
> Bruno Wolff III <[EMAIL PROTECTED]> writes:
> 
> > If someone did a naive implementation of first() and last() aggregates
> > for 8.1, is that something that would likely be accepted?
> 
> You mean like this?
> 
>  CREATE FUNCTION first_accum(anyelement,anyelement) RETURNS anyelement as 
> 'select coalesce($1,$2)' LANGUAGE SQL;
>  CREATE AGGREGATE first (BASETYPE=anyelement, SFUNC=first_accum, STYPE = 
> anyelement);
> 
> Though I suspect it would be faster as a native C implementation.

Pretty much that idea.

It just seemed odd to me that first and last weren't implemented, since they
seemed to be simple and could be used in cases where max or min couldn't
(because of no ordering) to do the same thing.

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to