Current CVS has strange parser for float type
wow=# select 5.3::float;
ERROR: Bad float8 input format '5.3'
wow=# select 5.3::float8;
ERROR: Bad float8 input format '5.3'
wow=# select 5.3::float4;
ERROR: Bad float4 input format '5.3'
wow=# select 5.3e-1::float4;
ERROR: Bad float4 input format '0.53'
wow=# select -5.3e-1::float4;
ERROR: Bad float4 input format '0.53'
wow=# select -5.3::float4;
ERROR: Bad float4 input format '5.3'
wow=# select 5.32222e2::float4;
ERROR: Bad float4 input format '532.222'
wow=# select version();
version
---------------------------------------------------------------------
PostgreSQL 7.3b2 on i386-unknown-freebsd4.6, compiled by GCC 2.95.3
(1 row)
Very strange or I missed something?
This 'feature' appears only on FreeBSD, Linux works fine.
--
Teodor Sigaev
teodor@stack.net
Works here:
test=> select 5.3::float;
float8
--------
5.3
(1 row)
---------------------------------------------------------------------------
Teodor Sigaev wrote:
wow=# select 5.3::float;
ERROR: Bad float8 input format '5.3'
wow=# select 5.3::float8;
ERROR: Bad float8 input format '5.3'
wow=# select 5.3::float4;
ERROR: Bad float4 input format '5.3'
wow=# select 5.3e-1::float4;
ERROR: Bad float4 input format '0.53'
wow=# select -5.3e-1::float4;
ERROR: Bad float4 input format '0.53'
wow=# select -5.3::float4;
ERROR: Bad float4 input format '5.3'
wow=# select 5.32222e2::float4;
ERROR: Bad float4 input format '532.222'
wow=# select version();
version
---------------------------------------------------------------------
PostgreSQL 7.3b2 on i386-unknown-freebsd4.6, compiled by GCC 2.95.3
(1 row)Very strange or I missed something?
This 'feature' appears only on FreeBSD, Linux works fine.--
Teodor Sigaev
teodor@stack.net---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
wow=# select 5,3::float;
?column? | float8
----------+--------
5 | 3
(1 row)
:)
Hannu Krosing wrote:
On Thu, 2002-10-17 at 23:34, Teodor Sigaev wrote:
wow=# select 5.3::float;
ERROR: Bad float8 input format '5.3'Could it be something with locales ?
Try:
select 5,3::float;
-------------
Hannu
--
Teodor Sigaev
teodor@stack.net
wow=# show lc_numeric;
lc_numeric
--------------
ru_RU.KOI8-R
(1 row)
wow=# select 5.3::float;
ERROR: Bad float8 input format '5.3'
wow=# set lc_numeric = 'C';
SET
wow=# select 5.3::float;
float8
--------
5.3
(1 row)
It's locale.
Tom Lane wrote:
Hannu Krosing <hannu@tm.ee> writes:
On Thu, 2002-10-17 at 23:34, Teodor Sigaev wrote:
wow=# select 5.3::float;
ERROR: Bad float8 input format '5.3'Could it be something with locales ?
Oooh, bingo! On HPUX:
regression=# select 5.3::float;
float8
--------
5.3
(1 row)regression=# set lc_numeric = 'de_DE.iso88591';
SET
regression=# select 5.3::float;
ERROR: Bad float8 input format '5.3'I think this is a consequence of the changes made a little while back
(by Peter IIRC?) in locale handling. It used to be that we deliberately
did *not* allow any LC_ setting except LC_MESSAGES to actually take
effect globally in the backend, and this sort of problem is exactly
why. I think we need to revert some aspects of that change.Bruce, this is a "must fix" open item ...
regards, tom lane
--
Teodor Sigaev
teodor@stack.net
Teodor Sigaev writes:
wow=# select 5.3::float;
ERROR: Bad float8 input format '5.3'
Does it accept '5,4'::float? Try running initdb with --locale=C.
--
Peter Eisentraut peter_e@gmx.net
Teodor Sigaev <teodor@stack.net> writes:
It's locale.
Yup. I've applied a fix in pg_locale.c. Turns out the code was trying
to do the right thing, but failed because setlocale() returns pointers
to modifiable static variables :-(
regards, tom lane