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

BUG #6527: Error in COPY documentation syntax

From: samuel(dot)gilbert(at)ec(dot)gc(dot)ca
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #6527: Error in COPY documentation syntax
Date: 2012-03-12 19:34:20
Message-ID: E1S7B0e-0005pL-Fl@wrigleys.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged on the website:

Bug reference:      6527
Logged by:          Samuel Gilbert
Email address:      samuel(dot)gilbert(at)ec(dot)gc(dot)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 ]".


Responses

pgsql-bugs by date

Next:From: Marti RaudseppDate: 2012-03-12 19:41:48
Subject: Re: BUG #6513: explain (analyze, buffers) and toasted fields
Previous:From: Jaime CasanovaDate: 2012-03-12 17:42:56
Subject: Re: BUG #6517: Volatile function erroneously optimized, does not consider change in schema path

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