Re: Function trunc() behaves in unexpected manner with different data types
От | Merlin Moncure |
---|---|
Тема | Re: Function trunc() behaves in unexpected manner with different data types |
Дата | |
Msg-id | AANLkTinCxQ5EWjVbULSa4L+MH=421Sh6=syEumUhmope@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Function trunc() behaves in unexpected manner with different data types (Merlin Moncure <mmoncure@gmail.com>) |
Список | pgsql-bugs |
On Fri, Feb 25, 2011 at 9:48 AM, Merlin Moncure <mmoncure@gmail.com> wrote: > On Fri, Feb 25, 2011 at 9:40 AM, Alvaro Herrera > <alvherre@commandprompt.com> wrote: >> Excerpts from Merlin Moncure's message of vie feb 25 12:28:25 -0300 2011: >> >>> no I wouldn't, and the pg_dump extra_float_digits setting addresses my >>> primary concern. =A0The client has a similar issue though -- suppose it >>> fetches a value from the server and updates it back -- which record >>> gets the update? =A0You would get different results if the client was >>> using binary or text features of the protocol. =A0Not saying this is >>> wrong or needs to be fixed, just pointing it out :-). >>> >>> update foo set val=3Dval + 1 where val =3D 2183.68; >> >> I think the mere idea of using floating point equality on a >> WHERE clause is bogus, regardless of text or binary format. > > That's a bridge to[sic] far -- akin to saying floating point should not > support equality operator. =A0select count(*) from foo where val >=3D > 2183.68? =A0you are ok getting different answers depending on method of > transmission of 2183.68 to the server? I stand corrected -- I did some digging and Postgres's handling of this issue is afaict correct: you are supposed to round on presentation only, and equality matching on floating point in sql (just like in C) is capricious exercise at best, at least without some defenses. So, we can definitely file under 'not a bug'. merlin
В списке pgsql-bugs по дате отправления: