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