Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id E7245B5DBF6; Tue, 5 Jul 2011 12:37:33 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 76911-01; Tue, 5 Jul 2011 15:37:27 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-fx0-f47.google.com (mail-fx0-f47.google.com [209.85.161.47]) by mail.postgresql.org (Postfix) with ESMTP id 8792CB5DBCE; Tue, 5 Jul 2011 12:37:26 -0300 (ADT) Received: by fxg11 with SMTP id 11so6984597fxg.34 for ; Tue, 05 Jul 2011 08:37:25 -0700 (PDT) Received: by 10.223.156.9 with SMTP id u9mr1837651faw.70.1309880245631; Tue, 05 Jul 2011 08:37:25 -0700 (PDT) Received: from [192.168.1.104] (58-53-133-95.pool.ukrtel.net [95.133.53.58]) by mx.google.com with ESMTPS id u20sm3231610fac.42.2011.07.05.08.37.23 (version=SSLv3 cipher=OTHER); Tue, 05 Jul 2011 08:37:24 -0700 (PDT) Date: Tue, 5 Jul 2011 18:37:15 +0300 From: Pavel Golub Reply-To: Pavel Golub Organization: Microolap X-Priority: 3 (Normal) Message-ID: <1991135552.20110705183715@gf.microolap.com> To: Robert Haas CC: Alvaro Herrera , pgsql-bugs , PostgreSQL Hackers Subject: Re: [HACKERS] COPY .... WITH (FORMAT binary) causes syntax error at or near "binary" In-Reply-To: References: <6510382810.20110705175206@gf.microolap.com> <1309878337-sup-685@alvh.no-ip.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201107/33 X-Sequence-Number: 30645 Hello, Robert. You wrote: RH> On Tue, Jul 5, 2011 at 11:06 AM, Alvaro Herrera RH> wrote: >> Excerpts from Pavel Golub's message of mar jul 05 10:52:06 -0400 2011: >>> Hello. >>> >>> System: PostgreSQL v9.0 Windows XP SP3 >>> SQL: COPY "tablename" TO STDOUT WITH (FORMAT binary) >>> ERROR:  syntax error at or near "binary" >>> LINE 1: ...OPY "tablename" TO STDOUT WITH (FORMAT binary) >>>                                                   ^ >>> >>> ********** Error ********** >>> >>> ERROR: syntax error at or near "binary" >>> SQL state: 42601 >>> Character: 55 >>> >>> But if I use 'FORMAT text' or 'FORMAT csv' all is OK. >>> >>> Suppose this happens because BINARY is not listed in >>> "unreserved_keyword" neither in "col_name_keyword parser" parser rules, but >>> listed in "type_func_name_keyword" instead. >> >> That seems pretty unfortunate.  Of course, it works if you quote it: >> >> COPY "tablename" TO STDOUT WITH (FORMAT "binary") >> >> I assume it's not in unreserved_keyword because it would cause a >> shift/reduce conflict elsewhere. RH> Yeah. In particular, it conflicts with the ancient copy syntax which RH> we still support for backwards compatibility with versions < 7.3. We RH> can fix the immediate problem with something like the attached. This patch is ugly. Sorry, Robert, but it's true. RH> (a) Should we do that? RH> (b) Should we back-patch it to 9.1 and 9.0? RH> (c) Should we consider removing compatibility with the ancient copy RH> syntax in 9.2, and de-reserving that keyword? (Given that the RH> workaround is this simple, I'm inclined to say "no", but could be RH> persuaded otherwise.) +1 for this. Pre-7.3 syntax is dead in fact for many years. -- With best wishes, Pavel mailto:pavel@gf.microolap.com