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

pg 9.1.1 - ERROR: could not find pathkey item to sort

From: bricklen <bricklen(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: pg 9.1.1 - ERROR: could not find pathkey item to sort
Date: 2011-09-27 00:37:45
Message-ID: CAGrpgQ-ME=7_4gHPyWd-dXZSuHxCcTfUq7rUHaOdvTp3pCRQvA@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-bugs
Is this a bug, or due to the way I am using the RANK() function in the
following query? The error is triggered when I use (sum(y) / sum(x))
in the ORDER BY of the RANK() function.

Simple test case:


create table t (a int, b int, x numeric, y integer );
insert into t
select g,round(mod(g,4)),
round((random()*1000)::NUMERIC,2),round((random()*1000)::NUMERIC) from
generate_series(1, 100) as g;

select  a,
        b,
        (sum(y) / sum(x)) as res,
        rank() over (partition by a,b order by (sum(y) / sum(x)) desc) as rank
        --rank() over (partition by a,b order by sum(y) desc) as rank
-- no error
from t
group by a,b;


select version();
                                                   version
--------------------------------------------------------------------------------------------------------------
PostgreSQL 9.1.1 on x86_64-unknown-linux-gnu, compiled by gcc (GCC)
4.4.5 20110214 (Red Hat 4.4.5-6), 64-bit

Any other details needed?


Cheers,

Bricklen

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2011-09-27 00:43:45
Subject: Re: [BUGS] BUG #6218: TRAP: FailedAssertion( "!(owner->nsnapshots == 0)", File: "resowner.c", Line: 365)
Previous:From: Alvaro HerreraDate: 2011-09-27 00:33:03
Subject: Re: [BUGS] BUG #6218: TRAP: FailedAssertion( "!(owner->nsnapshots == 0)", File: "resowner.c", Line: 365)

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