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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-bugs by date

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