Re: Finding Errors in .csv Input Data

From: Joe Conway <mail(at)joeconway(dot)com>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Finding Errors in .csv Input Data
Date: 2011-02-23 18:10:25
Message-ID: 4D654D91.4030401@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gary Fu 2011-02-23 18:31:58 slow building index and reference after Sybase to Pg
Previous Message runner 2011-02-23 17:51:35 Re: Index names not consistent