Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VUYPC-0003PI-QB for pgsql-bugs@arkaria.postgresql.org; Fri, 11 Oct 2013 08:49:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VUYPA-0008NO-My for pgsql-bugs@arkaria.postgresql.org; Fri, 11 Oct 2013 08:49:04 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VUYP9-0008NH-MS for pgsql-bugs@postgresql.org; Fri, 11 Oct 2013 08:49:03 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VUYP2-0006wz-P4 for pgsql-bugs@postgresql.org; Fri, 11 Oct 2013 08:49:03 +0000 Received: from pro.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id r9B8maV8010623; Fri, 11 Oct 2013 04:48:37 -0400 From: Tom Lane To: Terje Elde cc: Dimitri Fontaine , Bruce Momjian , Dwayne Towell , pgsql-bugs@postgresql.org Subject: Re: BUG #8516: Calling VOLATILE from STABLE function In-reply-to: <2798C998-40E6-4979-AD0A-64D744D015B7@elde.net> References: <20131010225931.GZ7092@momjian.us> <1c4601cec60d$ed9bfaa0$c8d3efe0$@docketnavigator.com> <20131010231546.GB7092@momjian.us> <2798C998-40E6-4979-AD0A-64D744D015B7@elde.net> Comments: In-reply-to Terje Elde message dated "Fri, 11 Oct 2013 10:02:36 +0200" Date: Fri, 11 Oct 2013 10:48:36 +0200 Message-ID: <3117.1381481316@sss.pgh.pa.us> X-Pg-Spam-Score: -0.7 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Terje Elde 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 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs