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




17 Oct 2002 22:47:01 +0500
Hannu Krosing <hannu@tm.ee>
Re: 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



Thu, 17 Oct 2002 22:34:50 +0400
Teodor Sigaev <teodor@stack.net>
Current CVS has strange parser for float type 

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

Thu, 17 Oct 2002 15:22:11 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: Current CVS has strange parser for float type
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

Thu, 17 Oct 2002 20:59:44 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: Current CVS has strange parser for float type 
Tom Lane wrote:
> 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 ...

Added.

-- 
  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

                               P O S T G R E S Q L

                          7 . 3  O P E N    I T E M S


Current at ftp://momjian.postgresql.org/pub/postgresql/open_items.

Required Changes
-------------------
Schema handling - ready? interfaces? client apps?
Drop column handling - ready for all clients, apps?
Get bison upgrade on postgresql.org for ecpg only (Marc)
Fix vacuum btree bug (Tom)
Fix client apps for autocommit = off
Fix pg_dump to handle 64-bit off_t offsets for custom format (Philip)
Fix local handling of floats

Optional Changes
----------------
Add schema dump option to pg_dump
Add/remove GRANT EXECUTE to all /contrib functions?
Missing casts for bit operations
\copy doesn't handle column names
COPY doesn't handle schemas
COPY quotes all table names


Documentation Changes
---------------------
Move documation to gborg for moved projects
Thu, 17 Oct 2002 21:08:55 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: Current CVS has strange parser for float type
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



Fri, 18 Oct 2002 11:31:41 +0400
Teodor Sigaev <teodor@stack.net>
Re: Current CVS has strange parser for float type
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



Fri, 18 Oct 2002 11:34:36 +0400
Teodor Sigaev <teodor@stack.net>
Re: Current CVS has strange parser for float type
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


Fri, 18 Oct 2002 18:18:14 +0200 (CEST)
Peter Eisentraut <peter_e@gmx.net>
Re: Current CVS has strange parser for float type 
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

Fri, 18 Oct 2002 16:55:32 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: Current CVS has strange parser for float type 


Peter Eisentraut wrote:
> Teodor Sigaev writes:
> 
> 
>>wow=# select 5.3::float;
>>ERROR:  Bad float8 input format '5.3'
>>
> 
> Does it accept '5,4'::float?  
Yes, it accepted '5,4'::float format.



-- 
Teodor Sigaev
teodor@stack.net


Sat, 19 Oct 2002 11:51:33 +0400
Teodor Sigaev <teodor@stack.net>
Re: Current CVS has strange parser for float type