Re: BUG #8516: Calling VOLATILE from STABLE function - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #8516: Calling VOLATILE from STABLE function
Date
Msg-id 3117.1381481316@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #8516: Calling VOLATILE from STABLE function  (Terje Elde <terje@elde.net>)
List pgsql-bugs
Terje Elde <terje@elde.net> writes:
> Would it be possible (and make sense) to solve this in a completely different way, not walking the function tree or
doingstatic 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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Bit String expand bug
Next
From: "Dwayne Towell"
Date:
Subject: Re: BUG #8516: Calling VOLATILE from STABLE function