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