Hash join explain is broken

From: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>
To: Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Hash join explain is broken
Date: 2019-06-10 18:28:12
Message-ID: CAPpHfdvGVegF_TKKRiBrSmatJL2dR9uwFCuR+teQ_8tEXU8mxg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi!

After 5f32b29c explain of Hash Join sometimes triggers an error.

Simple reproduction case is below.

# create table t (x int);
CREATE TABLE
# set enable_sort = off;
SET
# explain select * from t a, t b where a.x = (select 1 where b.x = 1);
ERROR: bogus varno: 65000

Before 5f32b29c the same case works OK.

# explain select * from t a, t b where a.x = (select 1 where b.x = 1);
QUERY PLAN
-------------------------------------------------------------------
Hash Join (cost=67.38..5311.24 rows=32512 width=8)
Hash Cond: (a.x = (SubPlan 1))
-> Seq Scan on t a (cost=0.00..35.50 rows=2550 width=4)
-> Hash (cost=35.50..35.50 rows=2550 width=4)
-> Seq Scan on t b (cost=0.00..35.50 rows=2550 width=4)
SubPlan 1
-> Result (cost=0.00..0.01 rows=1 width=4)
One-Time Filter: (b.x = 1)
(8 rows)

Originally spotted by Nikita Glukhov. I didn't investigate this case
further yet.

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2019-06-10 19:35:18 Re: tableam: abstracting relation sizing code
Previous Message - - 2019-06-10 18:22:41 Re: Temp table handling after anti-wraparound shutdown (Was: BUG #15840)