| From: | Eugen Konkov <kes-kes(at)yandex(dot)ru> |
|---|---|
| To: | Andreas Karlsson <andreas(at)proxel(dot)se>, PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org> |
| Subject: | Re: [PATCH] distinct aggregates within a window function WIP |
| Date: | 2020-04-22 07:05:19 |
| Message-ID: | 186624638.20200422100519@yandex.ru |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hello Andreas,
Tuesday, April 21, 2020, 6:17:00 PM, you wrote:
> On 4/21/20 5:06 PM, Eugen Konkov wrote:
>> Hi. I read the thread.
>>
>> Probably this fiddle will be helpful for testing:
>>
>> https://dbfiddle.uk/?rdbms=postgres_12&fiddle=abe845142a5099d921d3729043fb8491
>>
>> I recently encountered a problem:
>> Why Window-specific functions do not allow DISTINCT to be used within the function argument list?
>>
>> sum( DISTINCT order_cost ) OVER ( PARTITION BY invoice_id ORDER BY invoice_id, group_id RANGE unbound preceeding and unbound following )
>>
>> behavior is quite deterministic:
>>
>> ORDER BY will create peers in partition
>> DISTINCT will get only one peer
>>
>> I resolve my problem via two subqueries, but it seems this logic may
>> be applied to window functions (did not check this for other functions thought)
> Sorry, I do not follow. What problem did you encounter?
Lack of DISTINCT for window function SUM
--
Best regards,
Eugen Konkov
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2020-04-22 07:32:23 | Re: [BUG] non archived WAL removed during production crash recovery |
| Previous Message | tushar | 2020-04-22 06:45:31 | Re: [IBM z Systems] Getting server crash when jit_above_cost =0 |