| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Carsten Klein <c(dot)klein(at)datagis(dot)com> |
| Cc: | Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Strange results when casting string to double |
| Date: | 2022-02-18 20:07:47 |
| Message-ID: | 4137023.1645214867@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Carsten Klein <c(dot)klein(at)datagis(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter J. Holzer | 2022-02-18 21:42:49 | Re: Strange results when casting string to double |
| Previous Message | Carsten Klein | 2022-02-18 17:07:35 | Re: Strange results when casting string to double |