Re: COPY ... FROM stdin WITH FORMAT csv

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: COPY ... FROM stdin WITH FORMAT csv
Date: 2017-03-21 17:51:26
Message-ID: 4e8d2f31-d723-09cf-e160-d9570a6627d5@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 3/21/2017 10:31 AM, Alexander Farber wrote:
> 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...

its just csv, not 'csv' ...

> And I have tried adding/removing commas at the end of lines too.

if its getting a syntax error on the COPY command, its not yet read the
data...

note that COPY .... FROM STDIN doesn't actually read from stdin, it
requires the data to be passed through to it with a special API
(PQputCopyData() in libpq, or similar in other APIs). you can use
\copy in psql to stream the data from the same input.

--
john r pierce, recycling bits in santa cruz

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Olarte 2017-03-21 18:11:48 Re: COPY ... FROM stdin WITH FORMAT csv
Previous Message David G. Johnston 2017-03-21 17:49:02 Re: COPY ... FROM stdin WITH FORMAT csv