Re: I'm using both window and agg, is this expected sorting behavior?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: I'm using both window and agg, is this expected sorting behavior?
Дата
Msg-id 2600124.1696437176@sss.pgh.pa.us
обсуждение исходный текст
Ответ на I'm using both window and agg, is this expected sorting behavior?  (jinser <aimer@purejs.icu>)
Список pgsql-general
jinser <aimer@purejs.icu> writes:
> This is what confuses me, I've tried many versions of pgsql, at least
> including 11-16, and the behavior is consistent with the above; but I
> feel that maybe the order by in the window function should not affect
> the final result.

Since you have not specified an ORDER BY for the overall query
result, the implementation is entitled to return the rows in
any order it pleases.  Ours happens to sort by the window ordering
before computing the window functions, so that's what you get.
In this case anyway --- you shouldn't rely on that.

            regards, tom lane



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

Предыдущее
От: jinser
Дата:
Сообщение: I'm using both window and agg, is this expected sorting behavior?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Strategies for converting UTC data to local windows for arbitrary resolutions and timezones