From: | Alexander Farber <alexander(dot)farber(at)gmail(dot)com> |
---|---|
To: | |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: COPY ... FROM stdin WITH FORMAT csv |
Date: | 2017-03-21 19:11:53 |
Message-ID: | CAADeyWhMCPmowH4ApT=Jn_MKn2gH=3_Zot=our0b50oHsxKcVQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thank you - this has worked:
COPY words_reviews (uid, author, nice, review, updated) FROM stdin WITH
(FORMAT csv);
1,2,1,'1 is nice by 2','2017-03-01'
1,3,1,'1 is nice by 3','2017-03-02'
1,4,1,'1 is nice by 4','2017-03-03'
2,1,1,'2 is nice by 1','2017-03-01'
2,3,1,'2 is nice by 3','2017-03-02'
2,4,0,'2 is not nice by 4','2017-03-03'
\.
but I am confused about the comments that I should use \copy and not just
COPY and also that I could leave out WITH and brackets.
Because please take a look at the 9.6.2 psql output (COPY works, and
leaving out WITH brackets - not):
words=> COPY words_reviews (uid, author, nice, review, updated) FROM stdin
WITH (FORMAT csv);
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself.
>> 1,2,1,'1 is nice by 2','2017-03-01'
1,3,1,'1 is nice by 3','2017-03-02'
1,4,1,'1 is nice by 4','2017-03-03'
2,1,1,'2 is nice by 1','2017-03-01'
2,3,1,'2 is nice by 3','2017-03-02'
2,4,0,'2 is not nice by 4','2017-03-03'
\.
>> >> >> >> >> >> COPY 6
words=> COPY words_reviews (uid, author, nice, review, updated) FROM stdin
FORMAT csv;
ERROR: syntax error at or near "FORMAT"
LINE 1: ...s (uid, author, nice, review, updated) FROM stdin FORMAT csv...
^
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2017-03-21 19:21:13 | Re: COPY ... FROM stdin WITH FORMAT csv |
Previous Message | Francisco Olarte | 2017-03-21 18:11:48 | Re: COPY ... FROM stdin WITH FORMAT csv |