Re: BUG #15143: Window Functions – Paranthese not allowed before OVER term
От | David G. Johnston |
---|---|
Тема | Re: BUG #15143: Window Functions – Paranthese not allowed before OVER term |
Дата | |
Msg-id | CAKFQuwZWOC5ev8vSwfof3B9RLQxJxj8VxjXtN97hb-x0tZ6aMg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: BUG #15143: Window Functions – Paranthese not allowed before OVER term (David Rowley <david.rowley@2ndquadrant.com>) |
Ответы |
Re: BUG #15143: Window Functions – Paranthese not allowed before OVER term
|
Список | pgsql-bugs |
> Working as documented:
>
> "A window function call always contains an OVER clause directly following
> the window function's name and argument(s)"
Yeah, how else would the window function know which window clause it belongs to?
If you'd done: SELECT (LEAD(col) - LAG(col)) OVER (...) could
PostgreSQL just assume that you meant to link both the lead and lag to
the same over clause?
Well, if there is only a single aggregate function in the expression there isn't any ambiguity. If there happened to be more than one the system could emit a parsing error saying as much. While likely more user-friendly I don't imagine its worth the headache in the parser.
I did kinda mis-speak earlier though - there probably aren't any expressions that require a window function to end up in a subquery, but usually if I get to the point of using complex expressions readability will lead me to do so.
David J.
В списке pgsql-bugs по дате отправления: