Re: Current CVS has strange parser for float type

Lists: pgsql-hackers
From: Hannu Krosing <hannu(at)tm(dot)ee>
To: Teodor Sigaev <teodor(at)stack(dot)net>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Current CVS has strange parser for float type
Date: 2002-10-17 17:47:01
Message-ID: 1034876821.2600.2.camel@rh72.home.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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


From: Teodor Sigaev <teodor(at)stack(dot)net>
To: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Current CVS has strange parser for float type
Date: 2002-10-17 18:34:50
Message-ID: 3DAF02CA.5020304@stack.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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(at)stack(dot)net


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Teodor Sigaev <teodor(at)stack(dot)net>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Current CVS has strange parser for float type
Date: 2002-10-17 19:22:11
Message-ID: 200210171922.g9HJMB228147@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


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(at)stack(dot)net
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Hannu Krosing <hannu(at)tm(dot)ee>
Cc: Teodor Sigaev <teodor(at)stack(dot)net>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Current CVS has strange parser for float type
Date: 2002-10-18 00:59:44
Message-ID: 12994.1034902784@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hannu Krosing <hannu(at)tm(dot)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


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Hannu Krosing <hannu(at)tm(dot)ee>, Teodor Sigaev <teodor(at)stack(dot)net>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Current CVS has strange parser for float type
Date: 2002-10-18 01:08:55
Message-ID: 200210180108.g9I18tI06532@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 869 bytes

From: Teodor Sigaev <teodor(at)stack(dot)net>
To: Hannu Krosing <hannu(at)tm(dot)ee>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Current CVS has strange parser for float type
Date: 2002-10-18 07:31:41
Message-ID: 3DAFB8DD.8090605@stack.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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(at)stack(dot)net


From: Teodor Sigaev <teodor(at)stack(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Hannu Krosing <hannu(at)tm(dot)ee>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Current CVS has strange parser for float type
Date: 2002-10-18 07:34:36
Message-ID: 3DAFB98C.70003@stack.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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(at)tm(dot)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(at)stack(dot)net


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Teodor Sigaev <teodor(at)stack(dot)net>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Current CVS has strange parser for float type
Date: 2002-10-18 16:18:14
Message-ID: Pine.LNX.4.44.0210172120420.928-100000@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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(at)gmx(dot)net


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Teodor Sigaev <teodor(at)stack(dot)net>
Cc: Hannu Krosing <hannu(at)tm(dot)ee>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Current CVS has strange parser for float type
Date: 2002-10-18 20:55:32
Message-ID: 11886.1034974532@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Teodor Sigaev <teodor(at)stack(dot)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


From: Teodor Sigaev <teodor(at)stack(dot)net>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Current CVS has strange parser for float type
Date: 2002-10-19 07:51:33
Message-ID: 3DB10F05.4010909@stack.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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(at)stack(dot)net