Re: BUG #5841: rank()+1 fails, 1+rank() succeeds - Mailing list pgsql-bugs

From Alvaro Herrera
Subject Re: BUG #5841: rank()+1 fails, 1+rank() succeeds
Date
Msg-id 1295276957-sup-5631@alvh.no-ip.org
Whole thread Raw
In response to BUG #5841: rank()+1 fails, 1+rank() succeeds  ("Jeff Turner" <jeff@biccard.com>)
Responses Re: BUG #5841: rank()+1 fails, 1+rank() succeeds  (jeff@biccard.com)
List pgsql-bugs
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

pgsql-bugs by date:

Previous
From: "Jeff Turner"
Date:
Subject: BUG #5841: rank()+1 fails, 1+rank() succeeds
Next
From: Alvaro Herrera
Date:
Subject: Re: BUG #5835: PL/Python crashes