Tom Lane has just posted a message that begins thus to the hackers list:
This is just fantastic. I have lost count of the number of times I have wanted this feature. PostgreSQL just keeps getting better.
I've been idly amusing myself by trying to hack up support for
SQL-standard LATERAL subqueries. I've got something that turns over,
more or less:
regression=# select * from int4_tbl a, lateral (select unique1,unique2 from tenk1 b where a.f1 = unique1) x; f1 | unique1 | unique2 ----+---------+--------- 0 | 0 | 9998 (1 row) regression=# explain select * from int4_tbl a, lateral (select unique1,unique2 from tenk1 b where a.f1 = unique1) x; QUERY PLAN ----------------------------------------------------------------------------------- Nested Loop (cost=0.00..42.55 rows=5 width=12) -> Seq Scan on int4_tbl a (cost=0.00..1.05 rows=5 width=4) -> Index Scan using tenk1_unique1 on tenk1 b (cost=0.00..8.28 rows=1 width=8) Index Cond: (a.f1 = unique1) (4 rows)
This is just fantastic. I have lost count of the number of times I have wanted this feature. PostgreSQL just keeps getting better.