String to float conversion

From: raffaele(dot)lazzaro(at)tiscali(dot)it
To: pgsql-novice(at)postgresql(dot)org
Subject: String to float conversion
Date: 2005-03-22 14:34:33
Message-ID: 4212FD70000758D9@mail-2.tiscali.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi,
I have a "little" problem with data insertion.
Suppose I have a table with a column real for exemple:

CREATE TABLE number (value real);

I want to do something like this

insert into number(value)values('123,5');

but this raise an error because the comma is interpreted not as decimal separator
(the error is "invalid input syntax for type real" ). I have already tryed
to localize all configuration in postgresql.conf. Those are configurations
I have setted:

# - Locale and Formatting -

datestyle = 'european'
#timezone = unknown # actually, defaults to TZ environment setting
#australian_timezones = false
#extra_float_digits = 0 # min -15, max 2
#client_encoding = sql_ascii # actually, defaults to database encoding

# These settings are initialized by initdb -- they might be changed
lc_messages = 'Italian_Italy.1252' # locale for system error message strings
lc_monetary = 'Italian_Italy.1252' # locale for monetary formatting
lc_numeric = 'Italian_Italy.1252' # locale for number formatting
lc_time = 'Italian_Italy.1252' # locale for time formatting

I have already tried to re execute the initdb but still not works. So can
be changed the be behaviour of the string parser? How can I set a default
behaviour to parse the comma as a decimal separator?

Note that I cannot known (whe I ran the insert query) the type of the column.

Thanks to all
Luca

__________________________________________________________________
Tiscali Adsl 3 Mega Flat con 3 MESI GRATIS!
Con Tiscali Adsl 3 Mega Flat navighi con la Supervelocita'
a soli 29.95 euro al mese, senza limiti di tempo. E se attivi
entro il 31 Marzo, 3 MESI sono GRATIS!
Scopri come su http://abbonati.tiscali.it/adsl/sa/2flat_tc/

Browse pgsql-novice by date

  From Date Subject
Next Message Walker, Jed S 2005-03-22 14:52:21 Re: .pgpass file
Previous Message vladimir 2005-03-22 13:32:58 Re: Compiling 8.0.1 on Ubuntu AMD_64