Re: CSV file - Using COPY Command - Double-Quotes

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Walter <pgsql(at)thejohnsonplace(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: CSV file - Using COPY Command - Double-Quotes
Date: 2005-12-06 20:17:43
Message-ID: 200512062017.jB6KHhM00893@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Walter wrote:
> I have a problem using the copy command on a CSV file.
>
> All of the values within the CSV are surrounded with quotation marks. So
> a null value for a field looks like ""

It should be ,, for NULL.

> 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 : ""

Have you tried WITH NULL AS ''?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2005-12-06 21:09:04 Re: CSV file - Using COPY Command - Double-Quotes
Previous Message Jaime Casanova 2005-12-06 18:55:49 Re: SQL Statement Help Needed