Re: Coalesce bug ?

From: Chris Angelico <rosuav(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Coalesce bug ?
Date: 2012-12-21 15:32:13
Message-ID: CAPTjJmqAQA3nj58x4oyYp=+YnoqyAfaZ2_-nuFT57uyDanUv3Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Dec 22, 2012 at 2:25 AM, David Johnston <polobo(at)yahoo(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2012-12-21 15:35:44 Re: Using POSIX Regular Expressions on xml type fields gives inconsistent results
Previous Message Merlin Moncure 2012-12-21 15:30:28 Re: Heavy Function Optimisation