Re: [GENERAL] COPY ... FROM stdin WITH FORMAT csv

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: [GENERAL] COPY ... FROM stdin WITH FORMAT csv
Дата
Msg-id CAKFQuwZsS=aRJ8Ag3ThvUGmgUrmAJQC=d4keUYc2Se5o2z4M4w@mail.gmail.com
обсуждение исходный текст
Ответ на [GENERAL] COPY ... FROM stdin WITH FORMAT csv  (Alexander Farber <alexander.farber@gmail.com>)
Список pgsql-general
On Tue, Mar 21, 2017 at 10:31 AM, Alexander Farber <alexander.farber@gmail.com> 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.

В списке pgsql-general по дате отправления:

Предыдущее
От: Alexander Farber
Дата:
Сообщение: [GENERAL] COPY ... FROM stdin WITH FORMAT csv
Следующее
От: John R Pierce
Дата:
Сообщение: Re: [GENERAL] COPY ... FROM stdin WITH FORMAT csv