Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ViynV-0004Op-GE for pgsql-bugs@arkaria.postgresql.org; Wed, 20 Nov 2013 03:49:49 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1ViynU-0001NG-Rt for pgsql-bugs@arkaria.postgresql.org; Wed, 20 Nov 2013 03:49:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ViynT-0001N9-UH for pgsql-bugs@postgresql.org; Wed, 20 Nov 2013 03:49:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ViynR-0008C4-Hz for pgsql-bugs@postgresql.org; Wed, 20 Nov 2013 03:49:47 +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 rAK3ncee031137; Tue, 19 Nov 2013 22:49:38 -0500 From: Tom Lane To: Kevin Grittner cc: "j.rejda@konektel.cz" , "pgsql-bugs@postgresql.org" Subject: Re: BUG #8606: Materialized View WITH NO DATA bug In-reply-to: <1384901179.77177.YahooMailNeo@web162905.mail.bf1.yahoo.com> References: <1384901179.77177.YahooMailNeo@web162905.mail.bf1.yahoo.com> Comments: In-reply-to Kevin Grittner message dated "Tue, 19 Nov 2013 14:46:19 -0800" Date: Tue, 19 Nov 2013 22:49:38 -0500 Message-ID: <31136.1384919378@sss.pgh.pa.us> X-Pg-Spam-Score: -2.4 (--) 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 Kevin Grittner writes: > "j.rejda@konektel.cz" wrote: >> -- this returns "after some time" (as long as normal "SELECT >> long_test(10);" >> do) >> CREATE MATERIALIZED VIEW test2 AS >>    SELECT long_test(10) WITH NO DATA; >> >> -- it's ok or bug? > It's not a bug in the sense that it crashes or returns an incorrect > result, but it may be an opportunity for a performance enhancement. Meh. I'm not sure this can be considered to be a problem. One of the implications of marking a function immutable is that it has no side-effects worthy of concern; otherwise, it wouldn't be safe for the planner to constant-fold it, which is pretty much the whole point of immutability. But if you're concerned about how long it takes to evaluate, that's a kind of side effect, IMHO. Maybe it'd be better if you marked the function VOLATILE. But having said that, it seems that this complaint implies that CREATE MATERIALIZED VIEW ... WITH NO DATA still runs the query through a planning cycle. Why is that? I can't immediately see any benefit to doing so. 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