Re: BUG #8516: Calling VOLATILE from STABLE function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Terje Elde <terje(at)elde(dot)net>
Cc: Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>, Bruce Momjian <bruce(at)momjian(dot)us>, Dwayne Towell <dwayne(at)docketnavigator(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #8516: Calling VOLATILE from STABLE function
Date: 2013-10-11 08:48:36
Message-ID: 3117.1381481316@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Terje Elde <terje(at)elde(dot)net> writes:
> Would it be possible (and make sense) to solve this in a completely different way, not walking the function tree or doing static analysis, but simply setting and checking a bit during execution?

While it's possible that we could do something like that, I think it's
fairly unlikely that we would. The reason is that it would disable
constructs that some people find useful; that is, sometimes it's
intentional that a stable function calls a volatile one.

A couple of examples:

1. You might want to make some database updates but continue to do queries
with a pre-update snapshot. A single function can't accomplish that,
but the combination of a stable outer function with a volatile update
function can.

2. A security checking function (for use with Veil or the proposed row
security feature) might wish to log accesses without denying them. To
do that it'd have to be volatile, so if we had a restriction like this
the function would fail when invoked within a stable function.

You can imagine various ways around such issues, but it would add a lot
of complication.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message david.kumar 2013-10-11 10:13:13 BUG #8518: FreeBSD usage in 9.3.1
Previous Message Tom Lane 2013-10-11 08:14:29 Re: Bit String expand bug