Re: invalid input syntax for integer: ""

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Sebastian Tewes <stewes(at)tewes(dot)homelinux(dot)net>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: invalid input syntax for integer: ""
Date: 2004-05-04 14:58:25
Message-ID: Pine.LNX.4.33.0405040857010.30999-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sat, 1 May 2004, Sebastian Tewes wrote:

> Hello :-)
>
> got a little prob...
>
> so my table
>
> create table warengruppen ( kennung char (1),
> holder int,
> HauptWarenGruppe int,
> BezHWG varchar (50),
> WarenGruppe int,
> BezWG varchar (50));
>
>
> the copy syntax
>
> copy warengruppen FROM '/usr/pgsql/datanorm.wrg' with DELIMITER ';';
>
> and a smal part of my 'datanorm.wrg'
>
>
> S;;011;Dachsteine+Formst.;;;
> S;;011;;0111;Dachst.glatt(Biber);
> S;;011;;0112;Dachst.glatt(Tegal.);

the problem here is that "" is not an integer.

0 is. If you were to write a simple script file to process the input file
and turn the empty fields into 0s where they should be because they're
integers you're set.

OR, you can build a temp table with all text columns, import into that,
then use a select query to change the blank text columns to the character
0, then import that into the target table.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Contact AR-SD.NET 2004-05-04 15:03:50 Re: Check a value in array
Previous Message Andrew Sullivan 2004-05-04 14:37:45 Re: typecasting numeric(18,4) to varchar/text