Thanks for clarifying. I've submitted a note on the interactive
version of the docs, and attached a small patch to make explicit that
a window function is followed _immediately_ by an OVER clause, as the
syntax[1] indicates.
Regards,
Jeff
[1]
http://www.postgresql.org/docs/current/static/sql-expressions.html#SYNTAX-WINDOW-FUNCTIONS
Quoting Alvaro Herrera <alvherre@commandprompt.com>:
> Excerpts from Jeff Turner's message of lun ene 17 07:34:29 -0300 2011:
>
>> test=# select *, rank()+1 over (partition by bar) from t;
>> ERROR: syntax error at or near "over"
>> LINE 1: select *, rank()+1 over (partition by bar) from t;
>
> The "over" stuff is part of the expression; you can't add the +1 in the
> middle. This works:
>
> select *, rank() over (partition by bar) + 1 from t;
>
> --
> Ãlvaro Herrera <alvherre@commandprompt.com>
> The PostgreSQL Company - Command Prompt, Inc.
> PostgreSQL Replication, Consulting, Custom Development, 24x7 support
>