Re: Quoted NULLs with COPY FROM

From: Richard Huxton <dev(at)archonet(dot)com>
To: George Pavlov <gpavlov(at)mynewplace(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Quoted NULLs with COPY FROM
Date: 2006-01-24 09:19:26
Message-ID: 43D5F11E.8070203@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dave Page 2006-01-24 09:25:42 Re: Does this look ethical to you?
Previous Message Richard Huxton 2006-01-24 09:16:55 Re: FATAL: terminating connection due to administrator