Re: COPY FROM

From: "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk>
To: John Poltorak <jp(at)eyup(dot)org>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: COPY FROM
Date: 2001-01-15 12:55:48
Message-ID: 200101151255.f0FCtnN12878@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)Elphick(at)lfix(dot)co(dot)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

Browse pgsql-novice by date

  From Date Subject
Next Message rob 2001-01-15 14:12:19 Re: converting .xls to delimited file
Previous Message John Poltorak 2001-01-15 12:41:20 COPY FROM