On Fri, Jan 16, 2009 at 12:34:34PM -0500, Tom Lane wrote:
> 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, ...)

Thanks :)

> Also, we have never allowed SELECT-alias references in WHERE; window
> functions have nothing to do with that.

We don't appear to be able to use the actual thing in the target list
either.  At a minimum, this is a pretty enormous POLA violation, and I
think it rises to the level of a bug.

Cheers,
David.
-- 
David Fetter <da...@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fet...@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to