Re: UPDATE is not allowed in a non-volatile function - Mailing list pgsql-hackers

From Gaetano Mendola
Subject Re: UPDATE is not allowed in a non-volatile function
Date
Msg-id 418A16EE.1080300@bigfoot.com
Whole thread Raw
In response to Re: UPDATE is not allowed in a non-volatile function  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:> Thomas Hallgren <thhal@mailblocks.com> writes:>>>The Rationale for my opinion is that since there is a
needto accomplish>>what Gaetano needs, there should be declarative power to express it and>>thus, prevent "unsafe"
designs.We need a way to declare a function>>"stable with no _intrusive_ side effects".>>> What you think is
non-intrusivemay not be so at the database's level.>
 

Right, but the actual solution is far from be the good one.
If you claim that an immutable function "must not" do update because
otherwise the database could be in a inconsisten status, then we are in
trouble permitting a non-immutable function to be called by an
"immutable" one. I like see postgres stable as always was till now and
I prefer seen my code completelly broken than see someone call
a non-immutable function inside a "immutable" one and claim on this
list that he lost data.


I think a clean solution is enforce the check between functions call
( I prefer even only this one), and at the same time provide a "mutable"
attribute for tables ( a mutable table can be updated even inside an
immutable contest ).




Regards
Gaetano Mendola






pgsql-hackers by date:

Previous
From: Yann Michel
Date:
Subject: Re: Contribute to the development of PostgreSQL
Next
From: Simon Riggs
Date:
Subject: Re: Minor TODO list changes