Re: function side effects - Mailing list pgsql-hackers

From Tom Lane
Subject Re: function side effects
Date
Msg-id 22537.1266941323@sss.pgh.pa.us
Whole thread Raw
In response to Re: function side effects  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Responses Re: function side effects
Re: function side effects
List pgsql-hackers
"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
> Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Those classifications are meant as planner directives; they are
>> NOT meant to be bulletproof.  Hanging database integrity
>> guarantees on whether a "non volatile" function changes anything
>> is entirely unsafe.  To give just one illustration of the
>> problems, a nonvolatile function is allowed to call a volatile
>> one.
> Could it work to store a flag in each process to indicate when it is
> executing a non-volatile function, and throw an error on any attempt
> to call a volatile function or modify the database?

It's *not an error* for a nonvolatile function to call a volatile one.
At least it's never been in the past, and I'm sure you'd break some
applications if you made it so in the future.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: tie user processes to postmaster was:(Re: [HACKERS] scheduler in core)
Next
From: Tom Lane
Date:
Subject: Re: [COMMITTERS] Re: pgsql: Speed up CREATE DATABASE by deferring the fsyncs until after