pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: samuel.gilbert@ec.gc.ca
To: pgsql-bugs@postgresql.org
Subject: BUG #6527: Error in COPY documentation syntax
Date: Mon, 12 Mar 2012 19:34:20 +0000
Message-ID: <E1S7B0e-0005pL-Fl@wrigleys.postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      6527
Logged by:          Samuel Gilbert
Email address:      samuel.gilbert@ec.gc.ca
PostgreSQL version: 9.0.4
Operating system:   Linux
Description:        

There is an error in the syntax of the COPY statement in the documentation
for versions 9.0.x and 9.1.x.  I tested on 9.0.4 and 9.1.3.

According to the documentation, given the table exists and is compatible
with the CSV file, the following statement should work :

COPY improve_station FROM '/local/improve.csv' FORMAT CSV HEADER TRUE;

However, it doesn't work.  Instead I get the following error :

ERROR:  syntax error at or near "FORMAT"
LINE 1: ...ns FROM '/local/improve.csv' FORMAT CSV...
                                        ^

After trying a few trials and errors, I managed to find that ommiting FORMAT
gave me another error instead :

COPY improve_stations FROM '/local/improve.csv' CSV HEADER TRUE;
ERROR:  syntax error at or near "TRUE"
LINE 1: ...M '/local/improve.csv' CSV HEADER TRUE;
                                             ^

Removing the boolean value (TRUE) actually works.  This means that there are
at least two errors in the syntax specification in the documentation.
Instead of "FORMAT format_name", it should be "[ TEXT | CSV | BINARY ]" and
"HEADER [ boolean ]" should be "[ HEADER ]".




view thread (2+ messages)  latest in thread

Message-ID: <E1S7B0e-0005pL-Fl@wrigleys.postgresql.org>
Permalink:  ../E1S7B0e-0005pL-Fl@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/E1S7B0e-0005pL-Fl@wrigleys.postgresql.org

 · 

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: samuel.gilbert@ec.gc.ca
  Subject: Re: BUG #6527: Error in COPY documentation syntax
  In-Reply-To: <E1S7B0e-0005pL-Fl@wrigleys.postgresql.org>
  References: <E1S7B0e-0005pL-Fl@wrigleys.postgresql.org>

* 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