avoid pulling up subquerys that contain volatile functions? - Mailing list pgsql-hackers

From Jaime Casanova
Subject avoid pulling up subquerys that contain volatile functions?
Date
Msg-id c2d9e70e0510080851h3396e2b3hd1b21f83fe6f281c@mail.gmail.com
Whole thread Raw
Responses Re: avoid pulling up subquerys that contain volatile functions?
List 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_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 ;)


pgsql-hackers by date:

Previous
From: "Magnus Hagander"
Date:
Subject: Re: Kerberos brokenness and oops question in 8.1beta2
Next
From: Alvaro Herrera
Date:
Subject: Re: Issue is changing _bt_compare function and