Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1X7P3C-0003FA-QB for pgsql-bugs@arkaria.postgresql.org; Wed, 16 Jul 2014 13:15:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1X7P3B-0003Ub-OE for pgsql-bugs@arkaria.postgresql.org; Wed, 16 Jul 2014 13:15:13 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1X6lKx-0007qp-S8 for pgsql-bugs@postgresql.org; Mon, 14 Jul 2014 18:50:56 +0000 Received: from www255.your-server.de ([188.40.28.35]) by makus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1X6lKn-0006rw-SS for pgsql-bugs@postgresql.org; Mon, 14 Jul 2014 18:50:52 +0000 Received: from [88.198.220.130] (helo=sslproxy01.your-server.de) by www255.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-SHA256:256) (Exim 4.80.1) (envelope-from ) id 1X6lKk-00072n-M9 for pgsql-bugs@postgresql.org; Mon, 14 Jul 2014 20:50:42 +0200 Received: from [188.115.25.69] (helo=noether.homelinux.org) by sslproxy01.your-server.de with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1X6lKh-00075j-9d for pgsql-bugs@postgresql.org; Mon, 14 Jul 2014 20:50:39 +0200 Message-ID: <53C4267E.8090900@gluino.name> Date: Mon, 14 Jul 2014 20:50:38 +0200 From: David Tonhofer User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: pgsql-bugs@postgresql.org Subject: Documentation problem: The syntax for "\copy" is just wrong Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Authenticated-Sender: bughunt@gluino.name X-Virus-Scanned: Clear (ClamAV 0.98.4/19189/Mon Jul 14 12:36:34 2014) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org At http://www.postgresql.org/docs/9.3/static/app-psql.html#APP-PSQL-META-COMMANDS-COPY the syntax for the \copy command is given as follows: \copy { table [ ( column_list ) ] | ( query ) } { from | to } { 'filename' | program 'command' | stdin | stdout | pstdin | pstdout } [ [ with ] ( option [, ...] ) ] In particular, we read: "The syntax of the command is similar to that of the SQL COPY command, and option must indicate one of the options of the SQL COPY command." Well, it turns out that NOPE, THIS AIN'T TRUE. According to the description as given, the following should work. \copy table_to_fill from 'foofile.csv' with format csv, header true, delimiter ','; In particular, options are separated by "," and options use the same syntax as for COPY, which according to http://www.postgresql.org/docs/9.3/static/sql-copy.html is: FORMAT format_name OIDS [ boolean ] FREEZE [ boolean ] DELIMITER 'delimiter_character' NULL 'null_string' HEADER [ boolean ] QUOTE 'quote_character' ESCAPE 'escape_character' FORCE_QUOTE { ( column_name [, ...] ) | * } FORCE_NOT_NULL ( column_name [, ...] ) ENCODING 'encoding_name' Experiments however show \copy expects something else (the option's values basically?), a not separated by commas: \copy table_to_fill from 'foofile.csv' with csv header delimiter ','; Regards, -- David -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs