Re: loading data from flat text file - Mailing list pgsql-general

From Ron Peterson
Subject Re: loading data from flat text file
Date
Msg-id 392A9161.98C21E42@yellowbank.com
Whole thread Raw
In response to RE: loading data from flat text file  ("Voitenko, Denis" <dvoitenko@qode.com>)
Responses Re: loading data from flat text file
List 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-

pgsql-general by date:

Previous
From: Chris Bitmead
Date:
Subject: Re:
Next
From: Tatsuo Ishii
Date:
Subject: Re: Re: Join with other database's table