Clause accidentally pushed down ( Possible bug in Making Vars outer-join aware) - Mailing list pgsql-bugs

From Andrey Lepikhov
Subject Clause accidentally pushed down ( Possible bug in Making Vars outer-join aware)
Date
Msg-id 0b819232-4b50-f245-1c7d-c8c61bf41827@postgrespro.ru
Whole thread Raw
Responses Re: Clause accidentally pushed down ( Possible bug in Making Vars outer-join aware)  (Richard Guo <guofenglinux@gmail.com>)
List pgsql-bugs
Hi,
sqlancer benchmark raised an issue with pushing down clauses in LEFT 
JOINs. Example:

DROP TABLE IF EXISTS t1,t2,t3,t4 CASCADE;
CREATE TABLE t1 AS SELECT true AS x FROM generate_series(0,1) x;
CREATE TABLE t2 AS SELECT true AS x FROM generate_series(0,1) x;
CREATE TABLE t3 AS SELECT true AS x FROM generate_series(0,1) x;
CREATE TABLE t4 AS SELECT true AS x FROM generate_series(0,1) x;
ANALYZE;

EXPLAIN (ANALYZE, COSTS OFF)
SELECT ALL t1.x FROM t1, t2
   LEFT OUTER JOIN t3
   ON t3.x
     LEFT OUTER JOIN t4
     ON t3.x
WHERE t4.x ISNULL;

We should get zero tuples, right? But we have the explain:
Nested Loop (actual time=0.024..0.028 rows=4 loops=1)
...

REL_15_STABLE works correctly. As I remember, it could be induces by new 
machinery, introduced by the 'Making Vars outer-join aware' patch.

Sorry for flood, if you are working on that issue.

-- 
regards,
Andrey Lepikhov
Postgres Professional



pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #17804: Assertion failed in pg_stat after fetching from pg_stat_database and swithing cache->snapshot
Next
From: Alexander Lakhin
Date:
Subject: Re: BUG #17803: Rule "ALSO INSERT ... SELECT ..." fails to substitute default values