Re: COPY FROM - Mailing list pgsql-novice

From Oliver Elphick
Subject Re: COPY FROM
Date
Msg-id 200101151255.f0FCtnN12878@linda.lfix.co.uk
Whole thread Raw
In response to COPY FROM  (John Poltorak <jp@eyup.org>)
List pgsql-novice
John Poltorak wrote:
  >
  >Does anyone have an example on using COPY FROM?
  >
  >It isn't explained very well in the docs...

CREATE TABLE junk (id INTEGER, name TEXT);

COPY junk FROM stdin DELIMITERS ',';
1,Fred
2,George
\.


or have in a file /tmp/input:
1    Fred
2    George

(tab-separated fields).  Then

COPY junk FROM '/tmp/input';

/tmp/input has to be readable by the backend.

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47  6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "For I know that my redeemer liveth, and that he shall
      stand at the latter day upon the earth"
                                       Job 19:25



pgsql-novice by date:

Previous
From: John Poltorak
Date:
Subject: COPY FROM
Next
From: "Roman Dawydkin"
Date:
Subject: hide function