immutable stable volatile

Started by pgsql-general@list.coretech.roover 21 years ago2 messagesgeneral
Jump to latest
#1pgsql-general@list.coretech.ro
pgsql-general@list.coretech.ro

hello,

I have read the documentation couple of times and I still can not figure out
the following aspects.

if a function does insert/update/delete it needs to be stable or volatile ?
if a immutable function executes 'nextval' should itself be also volatile ?

thanks,
Razvan Radu

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: pgsql-general@list.coretech.ro (#1)
Re: immutable stable volatile

"PostgreSQL general mail list" <pgsql-general@list.coretech.ro> writes:

if a function does insert/update/delete it needs to be stable or volatile ?
if a immutable function executes 'nextval' should itself be also volatile ?

A function that has side-effects must be marked volatile; there are
no exceptions.

PG 8.0 actually enforces this to some extent, but you can get burned in
any version if you ignore the rule.

regards, tom lane