[PATCH] distinct aggregates within a window function WIP

Поиск
Список
Период
Сортировка
От Eugen Konkov
Тема [PATCH] distinct aggregates within a window function WIP
Дата
Msg-id 611952721.20200421180611@yandex.ru
обсуждение исходный текст
Ответы Re: [PATCH] distinct aggregates within a window function WIP  (Andreas Karlsson <andreas@proxel.se>)
Список pgsql-hackers
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
unboundfollowing )
 

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)

-- 
Best regards,
Eugen Konkov




В списке pgsql-hackers по дате отправления:

Предыдущее
От: tushar
Дата:
Сообщение: [IBM z Systems] Getting server crash when jit_above_cost =0
Следующее
От: Andreas Karlsson
Дата:
Сообщение: Re: [PATCH] distinct aggregates within a window function WIP