pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Pavel Golub <pavel@microolap.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Alvaro Herrera <alvherre@commandprompt.com>
Cc: pgsql-bugs <pgsql-bugs@postgresql.org>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] COPY .... WITH (FORMAT binary) causes syntax error at or near "binary"
Date: Tue, 5 Jul 2011 18:37:15 +0300
Message-ID: <1991135552.20110705183715@gf.microolap.com> (raw)
In-Reply-To: <CA+TgmoZebb5-8cnoTdNnCz3=AsqrFkzTuoK2FZAEbe3+rnF42w@mail.gmail.com>
References: <6510382810.20110705175206@gf.microolap.com>
	<1309878337-sup-685@alvh.no-ip.org>
	<CA+TgmoZebb5-8cnoTdNnCz3=AsqrFkzTuoK2FZAEbe3+rnF42w@mail.gmail.com>

Hello, Robert.

You wrote:

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




view thread (11+ messages)  latest in thread

Message-ID: <1991135552.20110705183715@gf.microolap.com>
Permalink:  ../1991135552.20110705183715@gf.microolap.com/
Also on:    postgresql.org/message-id/1991135552.20110705183715@gf.microolap.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: pavel@microolap.com, robertmhaas@gmail.com, alvherre@commandprompt.com, pgsql-hackers@postgresql.org
  Subject: Re: [HACKERS] COPY .... WITH (FORMAT binary) causes syntax error at or near "binary"
  In-Reply-To: <1991135552.20110705183715@gf.microolap.com>
  References: <6510382810.20110705175206@gf.microolap.com> <1309878337-sup-685@alvh.no-ip.org> <CA+TgmoZebb5-8cnoTdNnCz3=AsqrFkzTuoK2FZAEbe3+rnF42w@mail.gmail.com> <1991135552.20110705183715@gf.microolap.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox