Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id F02C11337C5B for ; Wed, 23 Mar 2011 21:23:59 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 28099-01-7 for ; Thu, 24 Mar 2011 00:23:42 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 9FE111337F64 for ; Wed, 23 Mar 2011 21:08:10 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p2O07rPG008298; Wed, 23 Mar 2011 20:07:53 -0400 (EDT) To: "Donald Fraser" cc: "[BUGS]" Subject: Re: Index Ignored Due To Use Of View In-reply-to: <479C9845FAF74274970CEF781EB9EF56@DEVELOP1> References: <479C9845FAF74274970CEF781EB9EF56@DEVELOP1> Comments: In-reply-to "Donald Fraser" message dated "Wed, 23 Mar 2011 13:10:28 -0000" Date: Wed, 23 Mar 2011 20:07:53 -0400 Message-ID: <8297.1300925273@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201103/302 X-Sequence-Number: 29812 "Donald Fraser" writes: > I found the solution to the problem and it would therefore appear as though this is not a bug! > If I change the function definition to be "STABLE" instead of "VOLATILE", then the problem goes away. Yeah, that's intentional. If the planner flattens a view that has a function in its output list, things get a lot less predictable about when the function will be called. For a volatile function, that can matter a lot. We used to flatten such views anyway, but we got enough complaints that we changed it. http://archives.postgresql.org/pgsql-committers/2006-08/msg00358.php regards, tom lane