David Fetter writes:
> Basically, there is no way I've found so far to qualify any window
> function in the target list, which makes a giant POLA violation.
The FM points out in at least two places that window functions logically
execute on the output of the WHERE/GROUP BY/HAVING steps. It's
co
On Fri, Jan 16, 2009 at 12:41:59PM -0500, Tom Lane wrote:
> David Fetter writes:
> > We don't appear to be able to use the actual thing in the target list
> > either.
>
> Would you translate that into English? Or at least an example without
> trivial syntax errors?
This works:
SELECT
typ,
David Fetter writes:
> We don't appear to be able to use the actual thing in the target list
> either.
Would you translate that into English? Or at least an example without
trivial syntax errors?
regards, tom lane
--
Sent via pgsql-general mailing list (pgsql-general@p
On Fri, Jan 16, 2009 at 12:34:34PM -0500, Tom Lane wrote:
> David Fetter 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
David Fetter 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 a
On Fri, Jan 16, 2009 at 12:23:16PM -0500, Jaime Casanova wrote:
> On Fri, Jan 16, 2009 at 12:07 PM, David Fetter wrote:
> >>
> >> Now i want only 3 records for every typ:
> >>
> >> test=# select typ, ts, rank() over (partition by typ order by ts desc )
> >> from foo where rank <= 3;
> >> ERROR:
On Fri, Jan 16, 2009 at 12:07 PM, David Fetter wrote:
>>
>> Now i want only 3 records for every typ:
>>
>> test=# select typ, ts, rank() over (partition by typ order by ts desc )
>> from foo where rank <= 3;
>> ERROR: column "rank" does not exist
>> LINE 1: ...rtition by typ order by ts desc )
On Thu, Jan 15, 2009 at 03:06:47PM +0100, A. Kretschmer wrote:
> Hi,
>
> first, many thanks to all for the great work, i'm waiting for 8.4.
>
>
> I have played with the new possibilities:
>
> test=# select typ, ts, rank() over (partition by typ order by ts desc ) from
> foo;
> typ |
Hi,
first, many thanks to all for the great work, i'm waiting for 8.4.
I have played with the new possibilities:
test=# select typ, ts, rank() over (partition by typ order by ts desc ) from
foo;
typ | ts | rank
-+---+--
1 | 20