Re: BUG #5841: rank()+1 fails, 1+rank() succeeds

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Jeff Turner <jeff(at)biccard(dot)com>
Cc: pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #5841: rank()+1 fails, 1+rank() succeeds
Date: 2011-01-17 15:10:19
Message-ID: 1295276957-sup-5631@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2011-01-17 16:09:56 Re: BUG #5835: PL/Python crashes
Previous Message Tim Uckun 2011-01-17 13:23:56 Re: Problems with adding a is not null to a query.