Re: Invalid input syntax for integer

From: "Jean-Yves F(dot) Barbier" <12ukwn(at)gmail(dot)com>
To: Hans Edwin Winzeler <hewinzeler(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Invalid input syntax for integer
Date: 2011-08-18 15:32:05
Message-ID: 20110818173205.3ccfeb70@anubis.defcon1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Thu, 18 Aug 2011 11:07:58 -0400, Hans Edwin Winzeler <hewinzeler(at)gmail(dot)com>
wrote:

> The input table from my .csv file (about 10 million records) that I am
> importing into PostgreSQL from a different program gives numbers in a format
> as follows, for example: 0-1788.000000 to indicate the value -1788.
> PostgreSQL gives me the error "invalid input syntax for integer" when I try
> to import the number (or invalid for numeric, real, double precision, etc.
> when I try to import it in those other formats). When I specify varchar(20)
> I get no problems and can import it, but then I can't use it numerically.
> How do I either:
>
>
> - Import the value as NUMERIC or INTEGER or REAL or FLOAT or something
> that I can use as a value rather than text, OR
> - How do I convert the varchar(20) that I have already imported into a
> numeric value?

AFAIK you can't without touching the CVS file.

Think a second: how can Pg (or any other app) recognize any number in
'0-1223...', which isn't a standard international notation convention?

--
When pleasure remains, does it remain a pleasure?

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Jean-Yves F. Barbier 2011-08-18 15:43:04 Re: Invalid input syntax for integer
Previous Message Hans Edwin Winzeler 2011-08-18 15:07:58 Invalid input syntax for integer