Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VUPSQ-00085B-4X for pgsql-bugs@arkaria.postgresql.org; Thu, 10 Oct 2013 23:15:50 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VUPSP-0007CH-Kl for pgsql-bugs@arkaria.postgresql.org; Thu, 10 Oct 2013 23:15:49 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VUPSO-0007C3-Uo for pgsql-bugs@postgresql.org; Thu, 10 Oct 2013 23:15:49 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VUPSM-0005B5-K4 for pgsql-bugs@postgresql.org; Thu, 10 Oct 2013 23:15:48 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1VUPSM-0006Mf-81; Thu, 10 Oct 2013 19:15:46 -0400 Date: Thu, 10 Oct 2013 19:15:46 -0400 From: 'Bruce Momjian' To: Dwayne Towell Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #8516: Calling VOLATILE from STABLE function Message-ID: <20131010231546.GB7092@momjian.us> References: <20131010225931.GZ7092@momjian.us> <1c4601cec60d$ed9bfaa0$c8d3efe0$@docketnavigator.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1c4601cec60d$ed9bfaa0$c8d3efe0$@docketnavigator.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -2.1 (--) 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 On Thu, Oct 10, 2013 at 04:10:35PM -0700, Dwayne Towell wrote: > > According to the documentation, f() should be marked VOLATILE also, since > > calling f() produces side effects. PostgreSQL does not give a warning (or > > better yet, an error); I think it should. > > I think the answer is that function authors are required to prevent > functions they mark as STABLE from calling VOLATILE functions. > > -- > > I understand it's an error (at least usually), my question/issue is why does > PostgreSQL NOT give at least a warning when a programmer (probably > accidentally) calls a VOLATILE function in one that he has specifically > tagged as STABLE? The compiler has all the information to notify the > programmer of a mistake, but isn't. This violates a fundamental principle of > software engineering--take every opportunity to prevent errors. Well, we can't walk the function tree to know all called functions, and those they call, so we don't even try. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs