On Sat, Dec 22, 2012 at 2:57 AM, jg <jg@xxxxxxxx> 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 be coherent. > 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 -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general