Re: CSV file - Using COPY Command - Double-Quotes - Mailing list pgsql-novice

From Daniel T. Staal
Subject Re: CSV file - Using COPY Command - Double-Quotes
Date
Msg-id 59870.63.172.115.138.1133904217.squirrel@MageHandbook.com
Whole thread Raw
In response to CSV file - Using COPY Command - Double-Quotes  (Walter <pgsql@thejohnsonplace.com>)
List pgsql-novice
On Tue, December 6, 2005 12:01 pm, Walter said:

> All of the values within the CSV are surrounded with quotation marks. So
> a null value for a field looks like ""
>
> I am trying to import the file and no matter what I do, it hits a null
> date field and says
>
> invalid input syntax for type date : ""

sed 's/,"",/,,/g' filename > filename.new

Should do the trick...

(That is: Replace ever occurance of ,"", with ,, in the file 'filename'
and place the result in 'filename.new'.  If you aren't on a Unix machine,
you may have to find another tool to do the same.)

Daniel T. Staal

---------------------------------------------------------------
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------


pgsql-novice by date:

Previous
From:
Date:
Subject: Re: CSV file - Using COPY Command - Double-Quotes
Next
From: Mike Ellsworth
Date:
Subject: Re: CSV file - Using COPY Command - Double-Quotes