Re: Documentation problem: The syntax for "\copy" is just wrong

From: Pedro Gimeno <pgsql-004(at)personal(dot)formauri(dot)es>
To: David Tonhofer <bughunt(at)gluino(dot)name>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Documentation problem: The syntax for "\copy" is just wrong
Date: 2014-07-16 14:53:16
Message-ID: 53C691DC.3020002@personal.formauri.es
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

David Tonhofer wrote, On 2014-07-14 20:50:
> 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 [, ...] ) ]
>
> [...]
>
> According to the description as given, the following should work.
>
> \copy table_to_fill from 'foofile.csv' with format csv, header true,
> delimiter ',';

This seems to be frequently reported. Can the parentheses be made more
prominent, e.g. by boldfacing them or putting them in quotes? They are
fairly easy to miss, because of the metacharacters [ ] { } interspersed
and the use of different conventions in different grammar specifications.

Alternatively, perhaps mention the parentheses explicitly in the text?

To the OP, this should work:

\copy table_to_fill from 'foofile.csv' with (format csv, header true,
delimiter ',');

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message arthur.j.odwyer 2014-07-16 19:38:28 BUG #10976: Two memory leaks in regcomp cleanup
Previous Message Tom Lane 2014-07-16 14:44:01 Re: SQLSTATE 00000 and message level LOG get logged when a server process crashes