From: | Josh Berkus <josh(at)agliodbs(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [pgsql-hackers] UPDATE is not allowed in a non-volatile function |
Date: | 2004-11-02 16:58:28 |
Message-ID: | 200411020858.28471.josh@agliodbs.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Gaetano,
> I do not consider my design as "unsafe", this is for example how a
> cache works: expose a "read" without side effect but updating internal
> statistics. After all the read will not alter the data that it expose
> but other data that the user even don't know the existence.
At issue is the working definitions of the function states (and yes, I know
these aren't the formal definitions but these are what is useful):
IMMUTABLE: result of function will always be the same given the same inputs;
STABLE: result of function will be the same for the duration of the
transaction.
VOLATILE: you can't count on any particular result based on the inputs
Any function involving an UPDATE -- and I write a LOT of them -- clearly falls
into the last group. You never know what you're going to get as a result of
an UPDATE; you could get an index violation, a lock wait, a deadlock, a
constraint violation, etc.
--
Josh Berkus
Aglio Database Solutions
San Francisco
From | Date | Subject | |
---|---|---|---|
Next Message | Gaetano Mendola | 2004-11-02 17:14:59 | Re: [pgsql-hackers] UPDATE is not allowed in a non-volatile function |
Previous Message | oozmen | 2004-11-02 16:33:25 | How to create/initialize/access an execution plan |