Re: Implementation DISTINCT for window aggregate function: SUM

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Eugen Konkov <kes-kes(at)yandex(dot)ru>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Implementation DISTINCT for window aggregate function: SUM
Date: 2020-04-19 03:07:38
Message-ID: CAApHDvpPqApuv_i_GdZF2wP7LTUugP3OV2WeGW2Yr1uXYjQZrg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, 18 Apr 2020 at 23:47, Eugen Konkov <kes-kes(at)yandex(dot)ru> wrote:
> select id, amount, sum(DISTINCT amount) over () as total
> from xx;

> Why this is not possible in PG?

Mainly because nobody has committed anything to implement it yet.

> Why Window-specific functions do not allow DISTINCT to be used within the function argument list.?
> Which problems are exists?

There are some details in [1] which you might be interested in.

David

[1] https://www.postgresql.org/message-id/flat/CAN1Pwonf4waD%2BPWkEFK8ANLua8fPjZ4DmV%2BhixO62%2BLiR8gwaA%40mail.gmail.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2020-04-19 03:40:01 Re: Poll: are people okay with function/operator table redesign?
Previous Message Justin Pryzby 2020-04-19 02:36:25 Re: [PATCH] Incremental sort (was: PoC: Partial sort)