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

From: "Jeff Turner" <jeff(at)biccard(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5841: rank()+1 fails, 1+rank() succeeds
Date: 2011-01-17 10:34:29
Message-ID: 201101171034.p0HAYTE7056475@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 5841
Logged by: Jeff Turner
Email address: jeff(at)biccard(dot)com
PostgreSQL version: 9.0.1
Operating system: Ubuntu 10.10
Description: rank()+1 fails, 1+rank() succeeds
Details:

Given a table:

create table t (foo varchar, bar integer);
insert into t values ('a', 1), ('b', 2), ('c', 1);

This query succeeds:

select *, 1+rank() over (partition by bar) from t;

However, replace '1+rank()' with 'rank()+1' and it fails:

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;

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Haas 2011-01-17 13:21:13 Re: Problems with adding a is not null to a query.
Previous Message Tim Uckun 2011-01-16 22:47:10 Re: Problems with adding a is not null to a query.