Re: Coalesce bug ? - Mailing list pgsql-general

From Chris Angelico
Subject Re: Coalesce bug ?
Date
Msg-id CAPTjJmpOS-oOq6pHyxiNb-p_vz0Yz9iLRe6m=WXqoVtEum=UNQ@mail.gmail.com
Whole thread Raw
In response to Re: Coalesce bug ?  ("jg" <jg@rilk.com>)
Responses Re: Coalesce bug ?  ("David Johnston" <polobo@yahoo.com>)
List pgsql-general
On Sat, Dec 22, 2012 at 2:57 AM, jg <jg@rilk.com> wrote:
> Hi,
>
> Interesting idea.
> With VOLATILE, the bug disappears.
> With IMMUTABLE, the EXPLAIN and the execution does not match !!!!
> That is a bug. Even if the behavior has to be different in VOLATILE and IMMUTABLE, the EXPLAIN and the execution MUST
becoherent. 
> JG

Just a word about your wording. Calling this a bug is somewhat poor
form; you're sounding hostile and accusatory, rather than looking to
learn and understand. It might indeed turn out to be a bug, but from
what else has happened in this thread, I'm more inclined to think that
the database is fine and your code is what's not working.

http://www.catb.org/esr/faqs/smart-questions.html#idp29846432

It's almost as if he read this very thread :)

Something to consider: Since you've told Postgres that your function
is immutable, it might be remembering the result from the first
execution and using it in the second. Try restarting the server
between the EXPLAIN and the test.

By the way, why do you declare your functions as "STRICT IMMUTABLE"
and "STRICT VOLATILE"?

ChrisA


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Using POSIX Regular Expressions on xml type fields gives inconsistent results
Next
From: Tom Lane
Date:
Subject: Re: Coalesce bug ?