Re: Minor point about contrib/xml2 functions "IMMUTABLE" marking

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: John Gray <jgray(at)azuli(dot)co(dot)uk>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Minor point about contrib/xml2 functions "IMMUTABLE" marking
Date: 2005-10-13 14:36:45
Message-ID: 200510131436.j9DEajc04176@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 no opti-
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-effects must 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(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-10-13 15:46:51 Re: Minor point about contrib/xml2 functions "IMMUTABLE" marking
Previous Message Charles Wegrzyn 2005-10-13 13:24:27 BUG #1962: ECPG and VARCHAR