Re: First Aggregate Funtion? - Mailing list pgsql-hackers

From Paul A Jungwirth
Subject Re: First Aggregate Funtion?
Date
Msg-id CA+renyURWvNyYiR++4zbzuXyzrY0jBgS0ViQYM2Lj0A8B7M=YQ@mail.gmail.com
Whole thread Raw
In response to Re: First Aggregate Funtion?  (Merlin Moncure <mmoncure@gmail.com>)
Responses Re: First Aggregate Funtion?
Re: First Aggregate Funtion?
List pgsql-hackers
> The above implementation of "first" aggregate returns the first non-NULL item
> value.

I'm curious what advantages this approach has over these FIRST/LAST
functions from the Wiki?:
   https://wiki.postgresql.org/wiki/First/last_%28aggregate%29

Also to get the "first non-null value" you can apply an ordering to
just the aggregate function, e.g.:
   select first(id order by start_time nulls last) from events;

If you want speed you should probably write a C version.

Is there something I'm missing?

Also since we're on the hackers list is this a proposal to add these
functions to core Postgres?

Yours,
Paul



pgsql-hackers by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: First Aggregate Funtion?
Next
From: Pavel Stehule
Date:
Subject: Re: patch: enhanced DROP POLICY tab complete