Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 37E40B5DC02; Tue, 5 Jul 2011 12:06:55 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 77139-01; Tue, 5 Jul 2011 15:06:49 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from spinlock.commandprompt.com (host-215.commandprompt.net [207.173.203.215]) by mail.postgresql.org (Postfix) with ESMTP id D682FB5DC08; Tue, 5 Jul 2011 12:06:48 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by spinlock.commandprompt.com (Postfix) with ESMTP id A9B46348045; Tue, 5 Jul 2011 08:06:47 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at commandprompt.com Received: from spinlock.commandprompt.com ([127.0.0.1]) by localhost (spinlock.commandprompt.com.commandprompt.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ugyfBqdlQdSE; Tue, 5 Jul 2011 08:06:45 -0700 (PDT) Received: from perhan.alvh.no-ip.org (unknown [190.95.22.55]) by spinlock.commandprompt.com (Postfix) with ESMTPSA id 94692348044; Tue, 5 Jul 2011 08:06:45 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 90DA26E474; Tue, 5 Jul 2011 11:06:42 -0400 (CLT) Content-Type: text/plain; charset=UTF-8 Cc: pgsql-bugs , PostgreSQL Hackers Subject: Re: [HACKERS] COPY .... WITH (FORMAT binary) causes syntax error at or near "binary" From: Alvaro Herrera To: Pavel Golub In-reply-to: <6510382810.20110705175206@gf.microolap.com> References: <6510382810.20110705175206@gf.microolap.com> Date: Tue, 05 Jul 2011 11:06:42 -0400 Message-Id: <1309878337-sup-685@alvh.no-ip.org> User-Agent: Sup/git 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/27 X-Sequence-Number: 30639 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. -- Álvaro Herrera The PostgreSQL Company - Command Prompt, Inc. PostgreSQL Replication, Consulting, Custom Development, 24x7 support