Re: UPDATE is not allowed in a non-volatile function

From: Gaetano Mendola <mendola(at)bigfoot(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: UPDATE is not allowed in a non-volatile function
Date: 2004-11-04 11:47:58
Message-ID: 418A16EE.1080300@bigfoot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Thomas Hallgren <thhal(at)mailblocks(dot)com> writes:
>
>>The Rationale for my opinion is that since there is a need to 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-intrusive may 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2004-11-04 11:51:44 Re: Minor TODO list changes
Previous Message Yann Michel 2004-11-04 11:07:18 Re: Contribute to the development of PostgreSQL