> 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 -- Sent via pgsql-hackers mailing list (email@example.com) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers