Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id BE1AD29F0DB for ; Mon, 12 Mar 2012 16:34:43 -0300 (ADT) Received: from mahout.postgresql.org ([98.129.198.123]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S7B0s-00022Q-E0 for pgsql-bugs@postgresql.org; Mon, 12 Mar 2012 19:34:42 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S7B0e-0005Yc-NG for pgsql-bugs@postgresql.org; Mon, 12 Mar 2012 19:34:21 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1S7B0e-0005pL-Fl for pgsql-bugs@postgresql.org; Mon, 12 Mar 2012 19:34:20 +0000 Date: Mon, 12 Mar 2012 19:34:20 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #6527: Error in COPY documentation syntax To: pgsql-bugs@postgresql.org From: samuel.gilbert@ec.gc.ca X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201203/98 X-Sequence-Number: 32659 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 ]".