Re: BUG #18976: -0.0 with float8 will be transformed to 0 in prepare statement but not in normal execution
От | Laurenz Albe |
---|---|
Тема | Re: BUG #18976: -0.0 with float8 will be transformed to 0 in prepare statement but not in normal execution |
Дата | |
Msg-id | c8c5090a0d720db8a5c4c382cce59afde3dc65d2.camel@cybertec.at обсуждение исходный текст |
Ответ на | BUG #18976: -0.0 with float8 will be transformed to 0 in prepare statement but not in normal execution (PG Bug reporting form <noreply@postgresql.org>) |
Ответы |
Re: BUG #18976: -0.0 with float8 will be transformed to 0 inprepare statement but not in normal execution
|
Список | pgsql-bugs |
On Thu, 2025-07-03 at 03:03 +0000, PG Bug reporting form wrote: > The following bug has been logged on the website: > > Bug reference: 18976 > Logged by: Chi Zhang > Email address: 798604270@qq.com > PostgreSQL version: 18beta1 > Operating system: Ubuntu 24.04 and docker > Description: > > The value -0.0 with float8 is transformed to 0 in prepared statements but > remains -0 in normal execution. Although 0 and -0 are numerically equal, > this discrepancy can lead to subtle bugs in certain cases—for example, when > the value is cast to a VARCHAR, as illustrated below. > > PREPARE prepare_query (float8) AS SELECT CAST($1 AS VARCHAR) = > CAST(-0.0::float8 AS VARCHAR); > EXECUTE prepare_query(-0.0); -- f That's not a bug, but a pilot error. If you feed a "float8", the result ist TRUE: EXECUTE prepare_query(-0.0::float8); ?column? ══════════ t (1 row) Yours, Laurenz Albe
В списке pgsql-bugs по дате отправления: