Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1goZRN-0000cb-A6 for pgsql-hackers@arkaria.postgresql.org; Tue, 29 Jan 2019 19:53:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1goZRK-00016T-EF for pgsql-hackers@arkaria.postgresql.org; Tue, 29 Jan 2019 19:52:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1goZRK-00013J-3Y for pgsql-hackers@lists.postgresql.org; Tue, 29 Jan 2019 19:52:58 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1goZRG-0003et-RL for pgsql-hackers@postgresql.org; Tue, 29 Jan 2019 19:52:56 +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 x0TJqiOl017788; Tue, 29 Jan 2019 14:52:44 -0500 From: Tom Lane To: Michael Paquier cc: Peter Eisentraut , Robert Haas , Andreas Karlsson , Andres Freund , Thomas Munro , Andrew Gierth , David Fetter , Pg Hackers Subject: Re: Early WIP/PoC for inlining CTEs In-reply-to: <20190129045158.GD3121@paquier.xyz> References: <20190111190403.77ye7m5mxypxsf4l@alap3.anarazel.de> <00818be9-2f63-f584-efcd-d97ee0662905@proxel.se> <5715d93e-6ebc-be17-c2c3-56a873100a38@proxel.se> <29576.1548084476@sss.pgh.pa.us> <12408.1548707732@sss.pgh.pa.us> <32184.1548713132@sss.pgh.pa.us> <20190129045158.GD3121@paquier.xyz> Comments: In-reply-to Michael Paquier message dated "Tue, 29 Jan 2019 13:51:58 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <17786.1548791564.1@sss.pgh.pa.us> Date: Tue, 29 Jan 2019 14:52:44 -0500 Message-ID: <17787.1548791564@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Michael Paquier writes: > On Mon, Jan 28, 2019 at 05:05:32PM -0500, Tom Lane wrote: >> Yeah, I thought about that too, but it doesn't seem like an improvement. >> If the query is very long (which isn't unlikely) I think people would >> prefer to see the option(s) up front. > Having these options at the front of the WITH clause looks more > natural to me. Well, we've managed to get agreement on the semantics of this thing, let's not get hung up on the syntax details. I propose that we implement and document this as WITH ctename AS [ MATERIALIZE { ON | OFF } ] ( query ) which is maybe a bit clunky but not awful, and it would leave room to generalize it to "AS [ optionname optionvalue [ , ... ] ]" if we ever need to. Looking at the precedent of e.g. EXPLAIN, we could probably allow just "MATERIALIZE" as well, with the boolean value defaulting to true. regards, tom lane