David Fetter <da...@fetter.org> writes: > I tried this: > SELECT > typ, > ts, > rank() over w AS foo_rank > FROM > foo > WINDOW w AS (partition by typ order by ts desc) > WHERE > foo_rank < 4;
> ERROR: syntax error at or near "WHERE" > LINE 8: WHERE > ^ RTFM ... WINDOW goes after WHERE (and GROUP BY, HAVING, ...) Also, we have never allowed SELECT-alias references in WHERE; window functions have nothing to do with that. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers