Re: [HACKERS] Question regarding new windowing functions in 8.4devel

From: David Fetter <david(at)fetter(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: [HACKERS] Question regarding new windowing functions in 8.4devel
Date: 2009-01-16 17:38:21
Message-ID: 20090116173821.GD20296@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Fri, Jan 16, 2009 at 12:34:34PM -0500, Tom Lane wrote:
> David Fetter <david(at)fetter(dot)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 <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mohamed 2009-01-16 17:41:32 Running queries to fetch a count of hits in DB on several things
Previous Message Tom Lane 2009-01-16 17:34:34 Re: Question regarding new windowing functions in 8.4devel

Browse pgsql-hackers by date

  From Date Subject
Next Message Gianni Ciolli 2009-01-16 17:39:11 FATAL: could not open relation pg_tblspc/491086/467369/491103: No such file or directory
Previous Message David E. Wheeler 2009-01-16 17:37:47 Re: FWD: Re: Updated backslash consistency patch