Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d1MKe-0006Qd-My for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Apr 2017 00:21:52 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d1MKe-0002Lm-2T for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Apr 2017 00:21:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d1MKc-0002KH-DH for pgsql-hackers@postgresql.org; Fri, 21 Apr 2017 00:21:50 +0000 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1d1MKZ-0005bN-Gv for pgsql-hackers@postgresql.org; Fri, 21 Apr 2017 00:21:49 +0000 Received: by mail-wm0-x236.google.com with SMTP id o81so4703966wmb.1 for ; Thu, 20 Apr 2017 17:21:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=XZMQu2/hTvrtPNJ9KOEjh70ARQXYWqmuXfY0CgXqbi0=; b=kAT+qMPLjDi6WS16VQP89NkYC0+KiB9ww5nmnDfZq4l+7/wm2xFWDz72W678zV0E+M XsXNWcw0E13MSKAEHNel+vqnDmjA/CpJ1ehxCCqvV1Bz8qDQLZSju746YwHIIEonKVNV dBGUarGpUtTV5I941xHbF5zuvj9O6pnIReTBYd8K3+9hLeKe1voDhdnO3/5Ig11W8+74 pGIkLOkPpHfL9c/6G2n/C+v4vfKbnkG5r/Z+QYKLAarCWfZvL4sfrKOykuanWLT0QnFj nfx1UWirFX22wAi7v/5HD5X8hwPRJ+ArGxkttcSSj2OAxUmHYprdDURRNRlscu4EWV6j alhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=XZMQu2/hTvrtPNJ9KOEjh70ARQXYWqmuXfY0CgXqbi0=; b=XvWWbtvhtPlv4iZoWQTiFyBMhRX6qEiHoJA685oVFgpK/op26r6Xud41ng8Zv5oTWb Xfh7f3wvehDM6evtoiyZAYYoOCyL2sZ4BU0zou+V8ktzYknIpCEdOvQtcPXn8rckniQ+ OGyhMbXi2a86D7e/E9+R33pnB+NaVuHl6CUeEjeA5aVEYeT14PK8c2MWQdUaergds4SR Q3n8TFhgWKxEMJKxRGrTHdYhYuxdYeOIm+Y++NXrHwY/NN7dWZy+Uvo6qNwiUk3xZ5kp 2VNBZfkgH8BukC+7HBDiEMwYh/CNttogBOrFP9md5ZfkHNErZNodwWceiSyOyOBMeBgm RG1A== X-Gm-Message-State: AN3rC/5bwYXBwulAvg76fx79hRfvYFI56DQzPB08SmmkbzGGOR9z41Jk nS+8zVVtUXbuCPniN+1etyDwgcWOvndwQgZnxRN5gXiKCXbv6tdMTKN6IpX/Eo2FYGnnOAX+jqf AVTo+T7t5npmiQdmMJ3Ipd9G6+xm0E9s9jHiAGU+vE7MIO9wGZYdoBt03ynR/nMICC2vnveowAR X8Uw== X-Received: by 10.28.100.195 with SMTP id y186mr5704182wmb.68.1492734105637; Thu, 20 Apr 2017 17:21:45 -0700 (PDT) Received: from [10.137.2.17] (ip-89-177-46-65.net.upcbroadband.cz. [89.177.46.65]) by smtp.gmail.com with ESMTPSA id 23sm9547674wrx.26.2017.04.20.17.21.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Apr 2017 17:21:44 -0700 (PDT) Subject: Re: WITH clause in CREATE STATISTICS To: pgsql-hackers@postgresql.org References: <20170420212426.ltvgyhnefvhixm6i@alvherre.pgsql> <22269.1492726397@sss.pgh.pa.us> From: Tomas Vondra Message-ID: <724d39fc-b7e9-7634-21e1-ebdba6f73bd6@2ndquadrant.com> Date: Fri, 21 Apr 2017 02:21:41 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <22269.1492726397@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) 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 On 04/21/2017 12:13 AM, Tom Lane wrote: > Alvaro Herrera writes: >> Simon just pointed out that having the WITH clause appear in the middle >> of the CREATE STATISTICS command looks odd; apparently somebody else >> already complained on list about the same. Other commands put the WITH >> clause at the end, so perhaps we should do likewise in the new command. > >> Here's a patch to implement that. I verified that if I change >> qualified_name to qualified_name_list, bison does not complain about >> conflicts, so this new syntax should support extension to multiple >> relations without a problem. > > Yeah, WITH is fully reserved, so as long as the clause looks like > WITH ( stuff... ) you're pretty much gonna be able to drop it > wherever you want. > >> Discuss. > > +1 for WITH at the end; the existing syntax looks weird to me too. > -1 from me I like the current syntax more, and WHERE ... WITH seems a bit weird to me. But more importantly, one thing Dean probably considered when proposing the current syntax was that we may add support for partial statistics, pretty much like partial indexes. And we don't allow WITH at the end (after WHERE) for indexes: test=# create index on t (a) where a < 100 with (fillfactor=10); ERROR: syntax error at or near "with" LINE 1: create index on t (a) where a < 100 with (fillfactor=10); ^ test=# create index on t (a) with (fillfactor=10) where a < 100; regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers