Re: window function count(*) and limit
От | Tom Lane |
---|---|
Тема | Re: window function count(*) and limit |
Дата | |
Msg-id | 22771.1287852169@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | window function count(*) and limit (Jesper Krogh <jesper@krogh.cc>) |
Ответы |
Re: window function count(*) and limit
|
Список | pgsql-hackers |
Jesper Krogh <jesper@krogh.cc> writes: > I have been puzzled about the evaluation order when using window > functions and limit. It's basically FROM -> WHERE -> window functions -> LIMIT. > I expected it to either count to 3 or blow up and tell me that count(*) > wasn't a window function. Any aggregate function can be used as a window function. It just aggregates over the whole partition (which in this case is all 8 rows that satisfy the WHERE). LIMIT is supposed to truncate the output at a specified number of rows, not change what is in those rows; so ISTM that this evaluation order is the expected one. If you want to put a LIMIT in front of the aggregates/window functions, put it in a sub-select. regards, tom lane
В списке pgsql-hackers по дате отправления: