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

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [BUGS] We are not following the spec for HAVING without GROUP
Date: 2005-03-14 06:12:53
Message-ID: 20050314061253.GA1274@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Mon, Mar 14, 2005 at 00:35:32 -0500,
Greg Stark <gsstark(at)mit(dot)edu> wrote:
>
> Bruno Wolff III <bruno(at)wolff(dot)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.

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.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2005-03-14 06:49:04 Re: [BUGS] We are not following the spec for HAVING without GROUP
Previous Message Tom Lane 2005-03-14 05:59:51 Re: BUG #1530: search on uuid indexed article returns no resultat

Browse pgsql-hackers by date

  From Date Subject
Next Message Neil Conway 2005-03-14 06:19:57 invalidating cached plans
Previous Message Tom Lane 2005-03-14 05:57:26 Re: Null Value Stored for Date e TimeStamp