Re: Question on STABLE functions limitations

Lists: pgsql-general
From: "Marc Mamin" <M(dot)Mamin(at)intershop(dot)de>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Question on STABLE functions limitations
Date: 2010-10-18 08:47:30
Message-ID: C4DAC901169B624F933534A26ED7DF31034BB838@JENMAIL01.ad.intershop.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hello,

I wonder if there are some special cases where STABLE functions should
be avoided.

I think for example of functions using set_config or querying the
advisory locks.

Thanks in advance,

Marc Mamin


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Marc Mamin" <M(dot)Mamin(at)intershop(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Question on STABLE functions limitations
Date: 2010-10-18 14:18:28
Message-ID: 19012.1287411508@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

"Marc Mamin" <M(dot)Mamin(at)intershop(dot)de> writes:
> I wonder if there are some special cases where STABLE functions should
> be avoided.

> I think for example of functions using set_config or querying the
> advisory locks.

set_config has side-effects and hence should not be done in non-volatile
functions.

regards, tom lane


From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Marc Mamin <M(dot)Mamin(at)intershop(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Question on STABLE functions limitations
Date: 2010-10-18 14:30:53
Message-ID: AANLkTi=r2RH6S+Boqg0t9Mvqj66DBa3fpiwBXyx9BbOA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Mon, Oct 18, 2010 at 4:47 AM, Marc Mamin <M(dot)Mamin(at)intershop(dot)de> wrote:
> I wonder if there are some special cases where STABLE functions should be
> avoided.
>
> I think for example of functions using set_config or querying the advisory
> locks.

Advisory locks are highly volatile and everything that touches them
should be considered volatile. They are completely outside the mvcc
snapshot system and aren't bound by its rules (sequences also fall
under this category).

merlin