Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d8u6T-0006Sf-Vl for pgsql-hackers@arkaria.postgresql.org; Thu, 11 May 2017 19:50:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d8u6T-0003vO-Gg for pgsql-hackers@arkaria.postgresql.org; Thu, 11 May 2017 19:50:25 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d8u6S-0003uy-Ob for pgsql-hackers@postgresql.org; Thu, 11 May 2017 19:50:24 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d8u6P-0000PY-ON for pgsql-hackers@postgresql.org; Thu, 11 May 2017 19:50:23 +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 v4BJoJGT026397; Thu, 11 May 2017 15:50:19 -0400 From: Tom Lane To: Alvaro Herrera cc: Simon Riggs , Andrew Dunstan , Tomas Vondra , PostgreSQL-development , Dean Rasheed Subject: Re: WITH clause in CREATE STATISTICS In-reply-to: <20170511193236.ecuwhixts7y3s7u5@alvherre.pgsql> References: <20170511193236.ecuwhixts7y3s7u5@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Thu, 11 May 2017 16:32:36 -0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <26395.1494532219.1@sss.pgh.pa.us> Date: Thu, 11 May 2017 15:50:19 -0400 Message-ID: <26396.1494532219@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Alvaro Herrera writes: > Tom Lane wrote: >> Have you thought further about the upthread suggestion to just borrow >> SELECT's syntax lock stock and barrel? > Bison seems to like the productions below. Is this what you had in > mind? These mostly mimic joined_table and table_ref, stripping out the > rules that we don't need. I'd suggest just using the from_list production and then complaining at runtime if what you get is too complicated. Otherwise, you have to maintain a duplicate set of productions, and you're going to be unable to throw anything more informative than "syntax error" when somebody tries to exceed the implementation limits. > Note that I had to put back the FOR keyword in there; without the FOR, > that is "CREATE STATS any_name opt_name_list expr_list FROM" there was > one shift/reduce conflict, which I tried to solve by splitting > opt_name_list using two rules (one with "'(' name_list ')'" and one > without), but that gave rise to two reduce/reduce conflicts, and I didn't > see any way to deal with them. That's fine. I was going to suggest using ON after the stats type list just because it seemed to read better. FOR is about as good. > (Note that I ended up realizing that stats_type_list is unnecessary > since we can use name_list.) Check. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers