Re: Importing into Postgres from a csv file - Mailing list pgsql-general

From Andrew McMillan
Subject Re: Importing into Postgres from a csv file
Date
Msg-id 39A59181.5A0D1F6E@catalyst.net.nz
Whole thread Raw
In response to Importing into Postgres from a csv file  ("Jake" <ccrasoro@home.com>)
List pgsql-general
Jake wrote:
>
> Does any one know if this is possible, and if so how?
>
> Jake

I have a perl script to do this which you are welcome to if you want
it.  I found problems using the:
    COPY ... DELIMITER ',' ...
syntax because it didn't (seem to me to) handle data enclosed in quotes,
which might contain quotes and newlines.  I.e. something like:

1,"Fred O'Neill said ""Hello!""
""Oh!  Hi!"" said Elizabeth.",37,21/3/2000

I had a lot of this sort of stuff in my data, which was exported from a
Microsoft product.  A perl script also let me handle nulls more
flexibly.

Regards,
                    Andrew.
--
_____________________________________________________________________
            Andrew McMillan, e-mail: Andrew@cat-it.co.nz
Catalyst IT Ltd, PO Box 10-225, Level 22, 105 The Terrace, Wellington
Me: +64 (21) 635 694, Fax: +64 (4) 499 5596, Office: +64 (4) 499 2267

pgsql-general by date:

Previous
From: richard excite
Date:
Subject: VARCHAR with null
Next
From: Franck Martin
Date:
Subject: RE: VARCHAR with null