Re: Minor point about contrib/xml2 functions "IMMUTABLE" marking - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Minor point about contrib/xml2 functions "IMMUTABLE" marking
Date
Msg-id 200510131436.j9DEajc04176@candle.pha.pa.us
Whole thread Raw
In response to Re: Minor point about contrib/xml2 functions "IMMUTABLE"  (Neil Conway <neilc@samurai.com>)
Responses Re: Minor point about contrib/xml2 functions "IMMUTABLE" marking
List pgsql-hackers
Neil Conway wrote:
> On Wed, 2005-12-10 at 23:46 -0400, Bruce Momjian wrote:
> > Agreed.  I have changed them both to stable.  I think xslt_process()
> > should be stable because it is unlikely you would want a URL's contents
> > to change inside a transaction
> 
> Why is it "unlikely"?
> 
> If a function's return value for a particular set of arguments could
> change within a single table scan, the function is volatile -- ISTM
> xslt_process() clearly falls within that definition.

My thought was that a web page lookup is going to be a very expensive
operation, so you would not want it to requery inside a transaction.

It is not like random() where you want it to be re-called and it is
inexpensive.

Our documentation says about VOLATILE:
             VOLATILE  indicates  that  the  function  value can             change even within a single table scan, so
noopti-             mizations  can  be  made.  Relatively  few database             functions are volatile in this
sense;some examples             are random(), currval(), timeofday(). Note that any             function that has
side-effectsmust  be  classified             volatile,  even if its result is quite predictable,             to prevent
calls from  being  optimized  away;  an             example is setval().
 

and I didn't think a web page lookup fit in that category.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Andreas Pflug
Date:
Subject: Re: Comments on columns in the pg_catalog tables/views
Next
From: Tom Lane
Date:
Subject: Re: Minor point about contrib/xml2 functions "IMMUTABLE" marking