Skip site navigation (1) Skip section navigation (2)

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

From: Pavel Golub <pavel(at)microolap(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, 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:37:15
Message-ID: 1991135552.20110705183715@gf.microolap.com (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-hackers
Hello, Robert.

You wrote:

RH> On Tue, Jul 5, 2011 at 11:06 AM, Alvaro Herrera
RH> <alvherre(at)commandprompt(dot)com> 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(at)gf(dot)microolap(dot)com


In response to

Responses

pgsql-hackers by date

Next:From: Robert HaasDate: 2011-07-05 15:40:49
Subject: Re: [HACKERS] COPY .... WITH (FORMAT binary) causes syntax error at or near "binary"
Previous:From: Robert HaasDate: 2011-07-05 15:34:47
Subject: Re: [HACKERS] COPY .... WITH (FORMAT binary) causes syntax error at or near "binary"

pgsql-bugs by date

Next:From: Robert HaasDate: 2011-07-05 15:40:49
Subject: Re: [HACKERS] COPY .... WITH (FORMAT binary) causes syntax error at or near "binary"
Previous:From: Robert HaasDate: 2011-07-05 15:34:47
Subject: Re: [HACKERS] COPY .... WITH (FORMAT binary) causes syntax error at or near "binary"

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group