Greg Stark wrote:
> On Wed, May 27, 2009 at 12:47 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I'm not too thrilled about that solution because it still eliminates
>> predictability of execution of volatile functions.
>
> How so? It means the volatile function might only be executed for the
> matching rows but the rows will still have the same value for the same
> rows for all references to the CTE which seems like the key property
> to me.
A volatile function could have side-effects, ie. insert rows to another
table. I would not recommend a design that relies on such behavior, but
it should be predictable how often the volatile function is run if you
do that.
-- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com