avoid pulling up subquerys that contain volatile functions?

From: Jaime Casanova <systemguards(at)gmail(dot)com>
To: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: avoid pulling up subquerys that contain volatile functions?
Date: 2005-10-08 15:51:14
Message-ID: c2d9e70e0510080851h3396e2b3hd1b21f83fe6f281c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

the comments fot contain_volatile_functions in clauses.c says...
src/backend/optimizer/util/clauses.c:
*
* XXX we do not examine sub-selects to see if they contain uses of
* volatile functions. It's not real clear if that is correct or not...
*/

but this example seems to clarify (or at least i think) that we have to avoid
pulling up subquerys containing volatile functions:

--- BEGIN SQL ---
create view vfoo_random as
select alu_codigo, is_true
from (select alu_codigo, (random() * 5) as is_true
from rec_m_alumno) as t_tmp
where is_true > 1;

select count(*) from vfoo_random where is_true < 1;

drop view vfoo_random;
--- END SQL ---

i thought it was just calling contain_volatile_function from
is_simple_subquery() in src/backend/optimizer/prep/prepjointree.c but it doesn't
work for me.
what i miss?

--
regards,
Jaime Casanova
(DBA: DataBase Aniquilator ;)

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2005-10-08 17:16:34 Re: Issue is changing _bt_compare function and
Previous Message Magnus Hagander 2005-10-08 15:09:36 Re: [HACKERS] Kerberos brokenness and oops question in 8.1beta2