Re: Question about numeric

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Erwin Ambrosch <ambre(at)ebutec(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Question about numeric
Date: 2002-05-22 18:21:14
Message-ID: 20020522111834.O53076-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 22 May 2002, Erwin Ambrosch wrote:

> Hi,
>
> when I import data from a text file (fildes are seperated with pipes) I get
> an error for fields of type numeric if there are no data for this fields.
>
> Example:
>
> CREATE TABLE mytable (
> id SERIAL,
> num VARCHAR(32),
> cost NUMERIC(6,2),
> info TEXT
> );
>
> A line to import from a text file.
>
> 1|123abc||This part is....
>
> Because of the empty field for the column cost, I get the following error:
>
> ERROR: copy: line 1, Bad numeric input format ''
> PQendcopy: resetting connection

Well '' isn't a valid numeric. If you were expecting a NULL, the default
NULL representation is \N. Try adding WITH NULL AS '' to your copy
command.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Command Prompt, Inc. 2002-05-22 18:57:43 Re: MacOS X Shared Buffers (SHMMAX)?
Previous Message Jeff Eckermann 2002-05-22 17:33:39 Re: Question about numeric