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_truefrom (select alu_codigo, (random() * 5) as is_true from rec_m_alumno) as t_tmpwhere
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 ;)