Re: Coalesce bug ? - Mailing list pgsql-general

From Chris Angelico
Subject Re: Coalesce bug ?
Date
Msg-id CAPTjJmqAQA3nj58x4oyYp=+YnoqyAfaZ2_-nuFT57uyDanUv3Q@mail.gmail.com
Whole thread Raw
In response to Re: Coalesce bug ?  ("David Johnston" <polobo@yahoo.com>)
Responses Re: Coalesce bug ?  ("jg" <jg@rilk.com>)
List pgsql-general
On Sat, Dec 22, 2012 at 2:25 AM, David Johnston <polobo@yahoo.com> wrote:
> You have defined the function as "IMMUTABLE".  The system is allowed to cache the results of a given call (i.e.
"ps3(2)")and return the value without actually executing the function ("never executed").  Your second example returns
"1"without a warning regarding the "2" invocation due to this.  The Query Plan you show also matches this behavior. 

Further reading on this subject:

http://www.postgresql.org/docs/9.1/static/xfunc-volatility.html

See particularly the second paragraph after the bullet list.

ChrisA


pgsql-general by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: Heavy Function Optimisation
Next
From: "David Johnston"
Date:
Subject: Re: Using POSIX Regular Expressions on xml type fields gives inconsistent results