pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Terje Elde <terje@elde.net>
To: Dimitri Fontaine <dimitri@2ndQuadrant.fr>
Cc: Bruce Momjian <bruce@momjian.us>
Cc: Dwayne Towell <dwayne@docketnavigator.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #8516: Calling VOLATILE from STABLE function
Date: Fri, 11 Oct 2013 10:02:36 +0200
Message-ID: <2798C998-40E6-4979-AD0A-64D744D015B7@elde.net> (raw)
In-Reply-To: <m27gdk6zny.fsf@2ndQuadrant.fr>
References: <E1VU0qE-0003bl-7o@wrigleys.postgresql.org>
	<20131010225931.GZ7092@momjian.us>
	<1c4601cec60d$ed9bfaa0$c8d3efe0$@docketnavigator.com>
	<20131010231546.GB7092@momjian.us>
	<m27gdk6zny.fsf@2ndQuadrant.fr>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On Oct 11, 2013, at 9:21 AM, Dimitri Fontaine <dimitri@2ndQuadrant.fr> wrote:

> Inter function dependencies is a hard topic indeed. I still would like
> to see some kind of progress being made someday. The general case is
> turing complete tho, because you can use EXECUTE against programatically
> generated SQL.
> 
> You could even generate a CREATE FUNCTION command from within a PL
> function and EXECUTE it then call the created function… and I think I've
> seen people do that in the past.
> 
> Still some kind of limited in scope static analysis for the cases where
> it's possible to do so would be great. With pg_depend tracking so that
> you know you're doing something wrong at DROP FUNCTION time.

I'm not very familiar with PostgreSQL internals, so I might be way off here, and I'm asking as much out of curiousity as anything else…

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?

That is, when you execute a STABLE function, set a bit (clear it when function is done), and always check it when executing any VOLATILE function?

If a volatile function checks the bit, and you're "inside" a stable function, you could then raise an exception for calling volatile inside stable?

Terje

Attachments:

  signature.asc (application/pgp-signature, 508B) download

view thread (7+ messages)  latest in thread

Message-ID: <2798C998-40E6-4979-AD0A-64D744D015B7@elde.net>
Permalink:  ../2798C998-40E6-4979-AD0A-64D744D015B7@elde.net/
Also on:    postgresql.org/message-id/2798C998-40E6-4979-AD0A-64D744D015B7@elde.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: terje@elde.net, dimitri@2ndQuadrant.fr, bruce@momjian.us, dwayne@docketnavigator.com
  Subject: Re: BUG #8516: Calling VOLATILE from STABLE function
  In-Reply-To: <2798C998-40E6-4979-AD0A-64D744D015B7@elde.net>
  References: <E1VU0qE-0003bl-7o@wrigleys.postgresql.org> <20131010225931.GZ7092@momjian.us> <1c4601cec60d$ed9bfaa0$c8d3efe0$@docketnavigator.com> <20131010231546.GB7092@momjian.us> <m27gdk6zny.fsf@2ndQuadrant.fr> <2798C998-40E6-4979-AD0A-64D744D015B7@elde.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox