Re: [BUGS] We are not following the spec for HAVING without GROUP

Greg Stark <gsstark@mit.edu>

From: Greg Stark <gsstark@mit.edu>
To: Bruno Wolff III <bruno@wolff.to>
Cc: Greg Stark <gsstark@mit.edu>, pgsql-hackers@postgresql.org
Date: 2005-03-14T05:35:32Z
Lists: pgsql-bugs, pgsql-hackers
Bruno Wolff III <bruno@wolff.to> 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.


-- 
greg