BUG #19101: Ceil on BIGINT could lost precision in decil function

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #19101: Ceil on BIGINT could lost precision in decil function
Дата
Msg-id 19101-8f44b0e27aa65d40@postgresql.org
обсуждение исходный текст
Ответы Re: BUG #19101: Ceil on BIGINT could lost precision in decil function
Re: BUG #19101: Ceil on BIGINT could lost precision in decil function
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      19101
Logged by:          Jason Smith
Email address:      dqetool@126.com
PostgreSQL version: 18.0
Operating system:   Ubuntu 22.04
Description:

I try to store a large number in `BIGINT` and run  `ceil(c1)` command.
However, the result lost some precision due to calling `decil` function.
```sql
CREATE TABLE t1 (c1 BIGINT);
INSERT INTO t1 VALUES (4854233034440979799);
-- dceil
SELECT ceil(c1) FROM t1; -- {4.854233034440979e+18}
```
The original number is expected to return. In this case, calling
numeric_ceil function may be proper, and I try the following case.
```sql
CREATE TABLE t1 (c1 DECIMAL(20,0));
INSERT INTO t1 VALUES (4854233034440979799);
-- numeric_ceil
SELECT ceil(c1) FROM t1; -- {4854233034440979799}
```


В списке pgsql-bugs по дате отправления: