Search Postgresql Archives

Re: COPY ... FROM stdin WITH FORMAT csv

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 21, 2017 at 10:31 AM, Alexander Farber <alexander.farber@xxxxxxxxx> wrote:
Good evening,

I keep rereading https://www.postgresql.org/docs/9.6/static/sql-copy.html but just can't figure the proper syntax to put some records into the table:
​[...]​

words=> COPY words_reviews (uid, author, nice, review, updated) FROM stdin WITH FORMAT 'csv';
ERROR:  syntax error at or near "FORMAT"
LINE 1: ...d, author, nice, review, updated) FROM stdin WITH FORMAT 'cs...


​​[ [ WITH ] ( option [, ...] ) ]

The above means the entire "WITH" section is optional, as is the word WITH.  However, if you want to add "with" options they must appear within parentheses, those are not optional.  Multiple options can appear within the single set of parentheses.

"""
FORMAT
Selects the data format to be read or written: text, csv (Comma Separated Values), or binary. The default is text.
"""

Valid values for format are as listed, no single quote required (not sure about if they are allowed)

Therefore:

WITH (FORMAT csv)

David J.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux