Re: loading data from flat text file

From: Ron Peterson <rpeterson(at)yellowbank(dot)com>
To: "Voitenko, Denis" <dvoitenko(at)qode(dot)com>
Cc: "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: loading data from flat text file
Date: 2000-05-23 14:10:41
Message-ID: 392A9161.98C21E42@yellowbank.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> "Voitenko, Denis" wrote:
>
> So I am almost there, except my data is formated as follows:
>
> "chunk1","chunk2","chunk3"
>
> how would I tell COPY that my data is encapsulated in " and separated
> by , ? Furthermore, I did not find a manual on the COPY command.
> Anyone?

In /usr/local/pgsql/doc (assuming that's where you installed PostgreSQL)
you will find a good deal of html format documentation. From the docs:

COPY [ BINARY ] table [ WITH OIDS ]
FROM { 'filename' | stdin }
[ [USING] DELIMITERS 'delimiter' ]
[ WITH NULL AS 'null string' ]
COPY [ BINARY ] table [ WITH OIDS ]
TO { 'filename' | stdout }
[ [USING] DELIMITERS 'delimiter' ]
[ WITH NULL AS 'null string' ]

Basically, you just need to specify the delimiters.

Bruce Momjian is also in the process of writing a book on PostgreSQL.
You can download a snapshot of its current state from
http://www.postgresql.org/docs/awbook.html.

-Ron-

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tatsuo Ishii 2000-05-23 14:36:21 Re: Re: Join with other database's table
Previous Message Chris Bitmead 2000-05-23 13:55:30 Re: