Re: Need help with COPY - Mailing list pgsql-general

From Peter Eisentraut
Subject Re: Need help with COPY
Date
Msg-id Pine.LNX.4.30.0106161445340.755-100000@peter.localdomain
Whole thread Raw
In response to Need help with COPY  (Jonathan Hseu <vomjom@vomjom.org>)
Responses Re: Need help with COPY
List pgsql-general
Jonathan Hseu writes:

> I want to import a table from a file.  The format of the table in the file is as
> such:
> "FName","LName","Address","City"
>
> The format of the table is:
> (FName varchar(80), LName varchar(80), Address varchar(80), City varchar(80))
>
> I want to do a:
> COPY table FROM 'filename' USING DELIMITERS ','
>
> The problem is, it also imports the quotes.  Also, there are sometimes commas in
> the address, and it takes those as delimiters.  Is there any way to make it take
> only the stuff within the quotes and ignore any delimiters within them?

You need to reformat your input files (strip quotes and use different
delimiter) or not use the COPY command.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


pgsql-general by date:

Previous
From: Dariusz Pietrzak
Date:
Subject: Re: ODBC, ssl, problems with.
Next
From: Peter Eisentraut
Date:
Subject: Re: NULL feilds and ERROR messages from libpq++