Volatile functions in subqueries don't prevent subqueries from being evaluated in initplans? - Mailing list pgsql-hackers

From Gregory Stark
Subject Volatile functions in subqueries don't prevent subqueries from being evaluated in initplans?
Date
Msg-id 87zln74wbg.fsf@oxford.xeocode.com
Whole thread Raw
Responses Re: Volatile functions in subqueries don't prevent subqueries from being evaluated in initplans?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hm, shouldn't this query notice that random() is volatile and not make the
subquery an initplan?


postgres=#  select i, (select (random()*1000)::integer  ) from x limit 5;i | ?column? 
---+----------1 |      6772 |      6773 |      6774 |      6775 |      677
(5 rows)

postgres=# explain  select i, (select (random()*1000)::integer  ) from x limit 5;                       QUERY PLAN
                  
 
-----------------------------------------------------------Limit  (cost=0.02..0.11 rows=5 width=4)  InitPlan    ->
Result (cost=0.00..0.02 rows=1 width=0)  ->  Seq Scan on x  (cost=0.00..64.80 rows=3480 width=4)
 
(4 rows)


--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com Ask me about EnterpriseDB's RemoteDBA services!


pgsql-hackers by date:

Previous
From: "Asko Oja"
Date:
Subject: Re: Patch: plan invalidation vs stored procedures
Next
From: Alvaro Herrera
Date:
Subject: make dist does not work in VPATH