Re: [HACKERS] COPY .... WITH (FORMAT binary) causes syntax error at or near "binary"

From: Pavel Golub <pavel(at)microolap(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] COPY .... WITH (FORMAT binary) causes syntax error at or near "binary"
Date: 2011-07-05 15:13:21
Message-ID: 1564444906.20110705181321@gf.microolap.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Hello, Alvaro.

You wrote:

AH> 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.

AH> That seems pretty unfortunate. Of course, it works if you quote it:

AH> COPY "tablename" TO STDOUT WITH (FORMAT "binary")

AH> I assume it's not in unreserved_keyword because it would cause a
AH> shift/reduce conflict elsewhere.

Well, there are two ways:
1. Change documentation, so quoted or double quoted values are
accepted

2. Fix parser

--
With best wishes,
Pavel mailto:pavel(at)gf(dot)microolap(dot)com

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Haas 2011-07-05 15:23:11 Re: [HACKERS] COPY .... WITH (FORMAT binary) causes syntax error at or near "binary"
Previous Message Alvaro Herrera 2011-07-05 15:06:42 Re: [HACKERS] COPY .... WITH (FORMAT binary) causes syntax error at or near "binary"

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-07-05 15:23:11 Re: [HACKERS] COPY .... WITH (FORMAT binary) causes syntax error at or near "binary"
Previous Message Jeff Davis 2011-07-05 15:11:02 Re: Range Types, constructors, and the type system