Implementation DISTINCT for window aggregate function: SUM
Hello PostgreSQL-development,
Oracle has implementation:
select id, amount, sum(DISTINCT amount) over () as total
from xx;
https://dbfiddle.uk/?rdbms=oracle_18&fiddle=8eeb60183ec9576ddb4b2c9f2874d09f
Why this is not possible in PG?
https://dbfiddle.uk/?rdbms=postgres_12&fiddle=97c05203af4c927ff9f206e164752767
Why Window-specific functions do not allow DISTINCT to be used within the function argument list.?
Which problems are exists?
--
Best regards,
Eugen Konkov
On Sat, 18 Apr 2020 at 23:47, Eugen Konkov <kes-kes@yandex.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]/messages/by-id/CAN1Pwonf4waD+PWkEFK8ANLua8fPjZ4DmV+hixO62+LiR8gwaA@mail.gmail.com which you might be interested in.
David
[1]: /messages/by-id/CAN1Pwonf4waD+PWkEFK8ANLua8fPjZ4DmV+hixO62+LiR8gwaA@mail.gmail.com