Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dNUFv-0001oS-Th for pgsql-bugs@arkaria.postgresql.org; Wed, 21 Jun 2017 01:16:28 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dNUFv-0006s6-BY for pgsql-bugs@arkaria.postgresql.org; Wed, 21 Jun 2017 01:16:27 +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 1dNUFD-0005dU-H0 for pgsql-bugs@postgresql.org; Wed, 21 Jun 2017 01:15:43 +0000 Received: from tama50.ecl.ntt.co.jp ([129.60.39.147]) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dNUF9-0001X7-Fb for pgsql-bugs@postgresql.org; Wed, 21 Jun 2017 01:15:41 +0000 Received: from vc1.ecl.ntt.co.jp (vc1.ecl.ntt.co.jp [129.60.86.153]) by tama50.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id v5L1Fb0C004771; Wed, 21 Jun 2017 10:15:37 +0900 Received: from vc1.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id 2010F5F680; Wed, 21 Jun 2017 10:15:37 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (jcms-pop21.ecl.ntt.co.jp [129.60.87.134]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id 12E885F623; Wed, 21 Jun 2017 10:15:37 +0900 (JST) Received: from [127.0.0.1] (unknown [129.60.241.61]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id 0DF94400BEA; Wed, 21 Jun 2017 10:15:37 +0900 (JST) Subject: Re: Beta 10 parser error for CREATE STATISTICS IF NOT EXISTS References: <20170621004237.GB8337@wolff.to> From: Amit Langote Message-ID: <73b2a51a-3cf9-a44c-4cd0-bbc611016eb4@lab.ntt.co.jp> Date: Wed, 21 Jun 2017 10:15:28 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <20170621004237.GB8337@wolff.to> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit To: Bruno Wolff III , pgsql-bugs@postgresql.org X-TM-AS-MML: disable 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 On 2017/06/21 9:42, Bruno Wolff III wrote: > I'm not seeing an obvious error in my attempt to use CREATE STATISTICS IF > NOT EXISTS. Given this is new, maybe there is a bug in the parser. > > Sample output: > psql (10beta1) > Type "help" for help. > > o365logs=# select version(); > > version > -------------------------------------------------------------------------------- > > ---------------------------- > PostgreSQL 10beta1 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 > 20150623 > (Red Hat 4.8.5-11), 64-bit > (1 row) > > o365logs=# CREATE STATISTICS IF NOT EXISTS logs_corrtest (dependencies) ON > record_type, operation FROM logs; > ERROR: syntax error at or near "NOT" > LINE 1: CREATE STATISTICS IF NOT EXISTS logs_corrtest (dependencies)... Looks like a documentation bug if the authors of the feature actually meant to implement the following syntax: CREATE [ IF NOT EXISTS ] STATISTICS create if not exists statistics words_stats on a, b from words; CREATE STATISTICS create if not exists statistics words_stats on a, b from words; NOTICE: statistics object "words_stats" already exists, skipping CREATE STATISTICS If that's really what's intended, it seems a bit inconsistent with most other commands and with DROP STATISTICS [ IF NOT EXISTS ] itself. Thanks, Amit -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs