Thread: 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, compiledby 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, Pennsylvania19073
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
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
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
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
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