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

subquery results bypassed

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: subquery results bypassed
Date: 2001-07-31 02:57:20
Message-ID: 200107310257.f6V2vKr73531@hub.org (view raw or flat)
Thread:
Lists: pgsql-bugs
Anthony Wood (woody+postgresqlbugs(at)switchonline(dot)com(dot)au) reports a bug with a severity of 1
The lower the number the more severe it is.

Short Description
subquery results bypassed

Long Description
The second query in the example code should return:

 a | b | c 
---+---+---
(0 rows)

but actually returns

 a | b | c 
---+---+---
 1 | 3 | 2
(1 row)


which is wrong, because this tuple is not in the subquery

Sample Code
CREATE TABLE "bug" ("a" TEXT, "b" TEXT, "c" TEXT);
INSERT INTO "bug" VALUES ('1','2','1');
INSERT INTO "bug" VALUES ('1','3','2');
SELECT DISTINCT ON ("a") * FROM "bug" ORDER BY "a","c";
SELECT * FROM (SELECT DISTINCT ON ("a") * FROM "bug" ORDER BY "a","c") bug WHERE "b"='3';
DROP TABLE "bug";


No file was uploaded with this report


Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2001-07-31 03:50:47
Subject: Re: subquery results bypassed
Previous:From: Tom LaneDate: 2001-07-31 01:56:17
Subject: Re: Re: [BUGS] WIN32 MULTIBYTE

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