Numeric casts in locale en_GB on FreeBSD 4.7

Started by Andrew Grilletover 22 years ago3 messagesbugs
Jump to latest
#1Andrew Grillet
andrew@grillet.co.uk

Hi,

I am unable to cast a string to float, any way I try.

This is FreeBSD Stable, with Postgresql 7.3.4.

Most (probably) legit methods produce either a message to the effect
that ' ##.##' is an illegal format or ' ' (ie a single space) is an
illegal format.

Workaround is to use en_US as the locale for numerics.

Sorry exact message not retained, butI am not putting the system back to
a non-working condition intentionally :-)

The documentation is not at all clear as to what should be a legal
format string for converting text to numbers, only numbers to text.

I think there should be a default that works if you say
to_number(variable);
(ie no format string) regardless of the locale.

I am a new user, and assumed it was my mistake for a good 6 hours
of experimenting :-(

Andrew

#2Noname
Lynn.Tilby@asu.edu
In reply to: Andrew Grillet (#1)
Re: Numeric casts in locale en_GB on FreeBSD 4.7

Andrew,

If you are using embedded sql try atof (ascii to float).
Lynn

Quoting Andrew Grillet <andrew@grillet.co.uk>:

Show quoted text

Hi,

I am unable to cast a string to float, any way I try.

This is FreeBSD Stable, with Postgresql 7.3.4.

Most (probably) legit methods produce either a message to the effect
that ' ##.##' is an illegal format or ' ' (ie a single space) is an
illegal format.

Workaround is to use en_US as the locale for numerics.

Sorry exact message not retained, butI am not putting the system back to

a non-working condition intentionally :-)

The documentation is not at all clear as to what should be a legal
format string for converting text to numbers, only numbers to text.

I think there should be a default that works if you say
to_number(variable);
(ie no format string) regardless of the locale.

I am a new user, and assumed it was my mistake for a good 6 hours
of experimenting :-(

Andrew

---------------------------(end of
broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to
majordomo@postgresql.org)

#3Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: Andrew Grillet (#1)
Re: Numeric casts in locale en_GB on FreeBSD 4.7

On Sat, 25 Oct 2003, Andrew Grillet wrote:

Hi,

I am unable to cast a string to float, any way I try.

This is FreeBSD Stable, with Postgresql 7.3.4.

Most (probably) legit methods produce either a message to the effect
that ' ##.##' is an illegal format or ' ' (ie a single space) is an
illegal format.

What statements were you trying exactly?