On Oct 11, 2013, at 9:21 AM, Dimitri Fontaine <dimi...@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
signature.asc
Description: Message signed with OpenPGP using GPGMail