Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group