Thread: COPY FROM

COPY FROM

From
John Poltorak
Date:
Does anyone have an example on using COPY FROM?

It isn't explained very well in the docs...

--
John


Re: COPY FROM

From
"Oliver Elphick"
Date:
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