On Thu, May 19, 2016 at 7:10 AM, Alexey Bashtanov wrote:
> As for the original question unfortunately the way from an extension to
> postgres core is not too easy
> and normally requires an extension to become popular and to be included in
> postgres distribution as a contrib module first.
>
Do
Hello Tom,
I agree such functions are very useful, as they allow you to use
ordinary aggregation functions such as sum/max/avg
along with first/last ones (traditionally served by DISTINCT ON or
LIMIT) in the same group-by node
which improves performance and readability.
The first/last extensi
On 19 May 2016 at 05:04, Tom Smith wrote:
> It would really save all the troubles for many people if postgresql has a
> built-in first/last function along with sum/avg.
> There is already a C extension and a wiki sample and implemented for
> window function.
> I am curious why these two functi
It would really save all the troubles for many people if postgresql has a
built-in first/last function along with sum/avg.
There is already a C extension and a wiki sample and implemented for
window function.
I am curious why these two functions were not added along their window
implementation
On Wed, May 18, 2016 at 10:36 PM, Adam Brusselback <
adambrusselb...@gmail.com> wrote:
> Here is an example that works in a single query. Since you have two
> different orders you want the data back in, you need to use subqueries to
> get the proper data back, but it works, and is very fast.
>
>
Here is an example that works in a single query. Since you have two
different orders you want the data back in, you need to use subqueries to
get the proper data back, but it works, and is very fast.
CREATE TEMPORARY TABLE foo AS
SELECT generate_series as bar
FROM generate_series(1, 100);
CR
I need to use both in single sql.
On Wed, May 18, 2016 at 9:08 PM, Adam Brusselback wrote:
> Is there a reason you can't do that now with a limit 1/order by/union all?
> Just have it ordered one way on the first query and the other on the
> bottom. That will give you two rows that are the first
On Wednesday, May 18, 2016, Tom Smith wrote:
> Hello:
>
> Is there a plan for 9.7 to enable using the two aggregate function
> as non-window function? i.e. enabling getting the first/last row
> in single sql without using window features.
> There is actually a C-extension for first()/last().
Is there a reason you can't do that now with a limit 1/order by/union all?
Just have it ordered one way on the first query and the other on the
bottom. That will give you two rows that are the first / last in your set
based on whatever column you order on.
On May 18, 2016 8:47 PM, "Tom Smith" wrot