Re: Strange results when casting string to double - Mailing list pgsql-general

From Tom Lane
Subject Re: Strange results when casting string to double
Date
Msg-id 4137023.1645214867@sss.pgh.pa.us
Whole thread Raw
In response to Re: Strange results when casting string to double  (Carsten Klein <c.klein@datagis.com>)
List pgsql-general
Carsten Klein <c.klein@datagis.com> writes:
> So, you're not aware of any ways this behavior could be achieved from 
> within PostgreSQL? Something like a custom cast (actually, there is 
> none) or something that could intercept string to double conversion? 

Well, you asserted that these installations are all alike ... but
sure, it's conceivable that somebody could've replaced the default
numeric -> float8 cast (i.e., numeric_float8()) with some other code
that does it a bit inaccurately.  There's only a pg_cast entry
connecting that function to those types.  Have you tried stepping
through things with a debugger, to see if numeric_float8 and float8in
are actually reached on the problematic system?

> That would be something to look at closer. The question is: how would 
> you implement such an evil database wide text to double conversion (just 
> to kid users) if you had to?

At the SQL level, your example does not involve text -> double.
The literal 1.56 is of type numeric.

            regards, tom lane



pgsql-general by date:

Previous
From: Carsten Klein
Date:
Subject: Re: Strange results when casting string to double
Next
From: "Peter J. Holzer"
Date:
Subject: Re: Strange results when casting string to double