BUG #2820: "select" faling with "distinct" clause on a subquery

Lists: pgsql-bugs
From: "trinchero" <trinchero(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2820: "select" faling with "distinct" clause on a subquery
Date: 2006-12-09 17:01:00
Message-ID: 200612091701.kB9H10OF042291@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 2820
Logged by: trinchero
Email address: trinchero(at)gmail(dot)com
PostgreSQL version: 8.2
Operating system: Windows XP
Description: "select" faling with "distinct" clause on a subquery
Details:

To reproduce:

1. create tables:

CREATE TABLE u_listino
(
u_listino_id numeric(10) NOT NULL,
u_tipolis_id numeric(10) NOT NULL
)
WITH OIDS;

CREATE TABLE u_tipolis
(
u_tipolis_id numeric(10) NOT NULL
)
WITH OIDS;

2. run the query:

SELECT U_Listino.U_LISTINO_ID FROM U_Listino
WHERE U_Listino.U_TIPOLIS_ID IN (SELECT DISTINCT U_TipoLis.U_TIPOLIS_ID
FROM U_TipoLis);

This give error:
could not find pathkey item to sort
sql state: XX000

Problem seen in a java application, and replicated using pg admin 3
(distributed with PostgresSQL 8.2)

If the same query is run without the DISTINCT, it gives no error.

Best regars.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "trinchero" <trinchero(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2820: "select" faling with "distinct" clause on a subquery
Date: 2006-12-10 20:22:37
Message-ID: 14202.1165782157@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

"trinchero" <trinchero(at)gmail(dot)com> writes:
> SELECT U_Listino.U_LISTINO_ID FROM U_Listino
> WHERE U_Listino.U_TIPOLIS_ID IN (SELECT DISTINCT U_TipoLis.U_TIPOLIS_ID
> FROM U_TipoLis);

> This give error:
> could not find pathkey item to sort

This has already been reported and fixed, but thanks for letting us know!

regards, tom lane