Re: BUG #12053: Strange behavior for numeric types with unspecified precision-scale
От | Tom Lane |
---|---|
Тема | Re: BUG #12053: Strange behavior for numeric types with unspecified precision-scale |
Дата | |
Msg-id | 15613.1417121313@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | BUG #12053: Strange behavior for numeric types with unspecified precision-scale (tommaso.sala@cla-it.eu) |
Ответы |
Re: BUG #12053: Strange behavior for numeric types with
unspecified precision-scale
|
Список | pgsql-bugs |
Tommaso Sala <tommaso.sala@cla-it.eu> writes: > We found that it is probably a bug in the data adapter (supplied by Devart > http://www.devart.com/). > But, once that weird value is written in DB by Devart adapter, there must > be some kind of strange behavior also in Postgres. > In fact, reading that value causes strange results: > postgres=# select "WEIRD_FIELD" from "TABLE"; > WEIRD_FIELD > ---------------- > 0.00 > (1 row) > postgres=# select "WEIRD_FIELD" + 0.01 from "TABLE"; > ?column? > ---------- > 0.01 > (1 row) > postgres=# select "WEIRD_FIELD" * 2 from "TABLE"; > ?column? > ---------- > 0.00 > (1 row) > postgres=# select "WEIRD_FIELD" + 0.001 from "TABLE"; > ?column? > ---------- > 0.002 > (1 row) > postgres=# select 1 / "WEIRD_FIELD" from "TABLE"; > ?column? > ----------------------- > 1000.0000000000000000 > (1 row) > postgres=# select TO_CHAR("WEIRD_FIELD", 'FM99999999D99999999') from > "TABLE"; > to_char > --------- > .001 > (1 row) > It's always 0.001 but if selected or multiplicated it becomes 0.00. That's pretty weird, but it's hard to debug without access to Devart's adapter. Can you trace what the adapter is doing when it inserts this value? (log_statement = all would help.) An idea that comes to mind is that maybe Devart is using binary parameters and transmitting a value that isn't 100% legal; but that's only a guess at this stage. (It does look like numeric_recv is pretty trusting about the input weight and dscale fields; I'm not sure if a bad dscale would explain these symptoms, but it seems possible.) regards, tom lane
В списке pgsql-bugs по дате отправления: