Re: Finding Errors in .csv Input Data - Mailing list pgsql-general

From Joe Conway
Subject Re: Finding Errors in .csv Input Data
Date
Msg-id 4D654D91.4030401@joeconway.com
Whole thread Raw
In response to Re: Finding Errors in .csv Input Data  (Rich Shepard <rshepard@appl-ecosys.com>)
List pgsql-general
On 02/23/2011 09:23 AM, Rich Shepard wrote:
> On Wed, 23 Feb 2011, David Johnston wrote:
>
>> Why can you not just import the CSV as generated by Access?
>
>   I don't want additional quotation marks on all text.

I haven't followed this thread too closely, so maybe I'm missing
something, but isn't this essentially what you need to do?

# cat /tmp/test.csv
1,"testing 123,456","hello world",42

create table testcsv(id int, f1 text, f2 text, f3 int);
copy testcsv from '/tmp/test.csv' with csv delimiter ',' quote '"';
select * from testcsv;
 id |       f1        |     f2      | f3
----+-----------------+-------------+----
  1 | testing 123,456 | hello world | 42
(1 row)

HTH,

Joe

--
Joe Conway
credativ LLC: http://www.credativ.us
Linux, PostgreSQL, and general Open Source
Training, Service, Consulting, & 24x7 Support


Attachment

pgsql-general by date:

Previous
From: runner
Date:
Subject: Re: Index names not consistent
Next
From: John R Pierce
Date:
Subject: Re: Data types for IP address.