Re: Quoted NULLs with COPY FROM - Mailing list pgsql-general

From Richard Huxton
Subject Re: Quoted NULLs with COPY FROM
Date
Msg-id 43D5F11E.8070203@archonet.com
Whole thread Raw
In response to Re: Quoted NULLs with COPY FROM  ("George Pavlov" <gpavlov@mynewplace.com>)
List pgsql-general
George Pavlov wrote:
>> Did you try NULL AS ''?
>
> yes i did. that is the default and does not change the outcome (same
> errors about trying to insert an empty string into a numeric field.

Well there's your problem. Quotes tend to imply a text field. Assuming
you don't want to write a short Perl script to pre-process the file the
simplest way would be to import into a temporary table with text columns
rather than numeric, then copy from that into the real table (with CASE
or two queries).

--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: FATAL: terminating connection due to administrator
Next
From: "Dave Page"
Date:
Subject: Re: Does this look ethical to you?