Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WTE0W-0007e5-PG for pgsql-bugs@arkaria.postgresql.org; Thu, 27 Mar 2014 17:22:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WTE0V-0004YA-Uh for pgsql-bugs@arkaria.postgresql.org; Thu, 27 Mar 2014 17:22:23 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WTE0U-0004Y3-RM for pgsql-bugs@postgresql.org; Thu, 27 Mar 2014 17:22:22 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WTE0N-0004Fl-Uu for pgsql-bugs@postgresql.org; Thu, 27 Mar 2014 17:22:22 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s2RHMEs5007590; Thu, 27 Mar 2014 13:22:14 -0400 From: Tom Lane To: kwalbrecht@cghtech.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #9743: subquery on view is not pulling up. In-reply-to: <20140327132134.17069.55219@wrigleys.postgresql.org> References: <20140327132134.17069.55219@wrigleys.postgresql.org> Comments: In-reply-to kwalbrecht@cghtech.com message dated "Thu, 27 Mar 2014 13:21:34 -0000" Date: Thu, 27 Mar 2014 13:22:14 -0400 Message-ID: <7589.1395940934@sss.pgh.pa.us> X-Pg-Spam-Score: -2.3 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org kwalbrecht@cghtech.com writes: > When I query a view which has calculated values, even if I don't select one > of the calculated values, they are being calculated. This example looks like the functions in question are marked volatile; that prevents the view from being flattened, since doing so would eliminate side-effects the user might be expecting to happen. Assuming yours are side-effect-free, mark them stable or immutable as appropriate. http://www.postgresql.org/docs/9.2/static/xfunc-volatility.html regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs