Re: First Aggregate Funtion?

From: Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: sudalai <sudalait2(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: First Aggregate Funtion?
Date: 2015-07-20 15:06:23
Message-ID: CA+renyURWvNyYiR++4zbzuXyzrY0jBgS0ViQYM2Lj0A8B7M=YQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2015-07-20 15:16:23 Re: patch: enhanced DROP POLICY tab complete
Previous Message Merlin Moncure 2015-07-20 14:53:29 Re: First Aggregate Funtion?