pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #6527: Error in COPY documentation syntax
2+ messages / 2 participants
[nested] [flat]
* BUG #6527: Error in COPY documentation syntax
@ 2012-03-12 19:34 samuel.gilbert@ec.gc.ca
0 siblings, 1 reply; 2+ messages in thread
From: samuel.gilbert@ec.gc.ca @ 2012-03-12 19:34 UTC (permalink / raw)
To: pgsql-bugs
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 ]".
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #6527: Error in COPY documentation syntax
@ 2012-03-13 07:55 Guillaume Lelarge <guillaume@lelarge.info>
parent: samuel.gilbert@ec.gc.ca
0 siblings, 0 replies; 2+ messages in thread
From: Guillaume Lelarge @ 2012-03-13 07:55 UTC (permalink / raw)
To: samuel.gilbert@ec.gc.ca; +Cc: pgsql-bugs
On Mon, 2012-03-12 at 19:34 +0000, samuel.gilbert@ec.gc.ca wrote:
> 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;
>
No, it shouldn't work. You forgot parentheses, and commas. This 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 ]".
>
No error, and no bug. The documentation says (even if it's hard to see)
that you need parentheses and commas. The examples show it too.
--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2012-03-13 07:55 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-03-12 19:34 BUG #6527: Error in COPY documentation syntax samuel.gilbert@ec.gc.ca
2012-03-13 07:55 ` Guillaume Lelarge <guillaume@lelarge.info>
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