Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VUN6u-0001hT-Gl for pgsql-bugs@arkaria.postgresql.org; Thu, 10 Oct 2013 20:45:28 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VUN6s-0000Bl-EL for pgsql-bugs@arkaria.postgresql.org; Thu, 10 Oct 2013 20:45:26 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VU0qM-0006IF-Ci for pgsql-bugs@postgresql.org; Wed, 09 Oct 2013 20:58:54 +0000 Received: from mahout.postgresql.org ([2001:4800:7903:4::123]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VU0qK-0001ZS-B3 for pgsql-bugs@postgresql.org; Wed, 09 Oct 2013 20:58:53 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by mahout.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VU0qJ-0008KY-HN for pgsql-bugs@postgresql.org; Wed, 09 Oct 2013 20:58:51 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.80) (envelope-from ) id 1VU0qE-0003bl-7o for pgsql-bugs@postgresql.org; Wed, 09 Oct 2013 20:58:46 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: BUG #8516: Calling VOLATILE from STABLE function To: pgsql-bugs@postgresql.org From: dwayne@docketnavigator.com Message-Id: Date: Wed, 09 Oct 2013 20:58:46 +0000 X-Pg-Spam-Score: -0.2 (/) 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 The following bug has been logged on the website: Bug reference: 8516 Logged by: Dwayne Towell Email address: dwayne@docketnavigator.com PostgreSQL version: 9.2.4 Operating system: CentOS Description: Why doesn't PostgreSQL give a warning when calling a volatile function from a stable function? For example: CREATE TABLE x (val double); CREATE FUNCTION g() RETURNS boolean AS $$ INSERT INTO x SELECT rand() RETURNING val>0.5; $$ LANGUAGE SQL VOLATILE; CREATE FUNCTION f() RETURNS boolean AS $$ SELECT g(); -- this is where the stability-violation happens $$ LANGUAGE SQL STABLE; -- this is a lie 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. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs