Re: COPY FROM and multiple null strings

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Angva <angvaw(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: COPY FROM and multiple null strings
Date: 2007-03-03 19:12:15
Message-ID: 45E9C88F.1060906@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Angva wrote:
> Hi,
>
> I've run into a little snag in my data loads, and I come seeking
> advice before I resort to an ugly workaround...
>
> I have a function which runs COPY FROM several times. My problem is
> that my data provider uses symbols to represent nulls - there is a
> different symbol for each different data type. For instance a null
> date would be '1900-01-01' and a null string would be '#'. Is there
> any way to define multiple null strings in the COPY FROM command?
>
> As always, any suggestions would be much appreciated.

Man... that sounds like eating elementary school spinach... you remember
the kind that slithered down your throat?

There are two immediate ways I can think of to handle this.

1. Write a parser in <insert favorite language) and clean the file
before insertion

2. copy everything into text columns and clean from there.

Joshua D. Drake

>
> Thanks,
> Mark
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org/
>

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martin Gainty 2007-03-03 20:00:32 Partition Table
Previous Message Joshua D. Drake 2007-03-03 19:03:48 Re: How Can I set a non standard date format?