Re: BUG #15812: Select statement of a very big number, with adivision operator seems to round up.

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: BUG #15812: Select statement of a very big number, with adivision operator seems to round up.
Дата
Msg-id 20190517160211.GA27103@alvherre.pgsql
обсуждение исходный текст
Ответ на BUG #15812: Select statement of a very big number, with a division operator seems to round up.  (PG Bug reporting form <noreply@postgresql.org>)
Ответы RE: BUG #15812: Select statement of a very big number, with adivision operator seems to round up.  (Kaleb Akalework <kaleb.akalework@asg.com>)
Re: BUG #15812: Select statement of a very big number, with adivision operator seems to round up.  (Andres Freund <andres@anarazel.de>)
Список pgsql-bugs
On 2019-May-17, PG Bug reporting form wrote:

> create table test_table
> (
>     REQUEST_UUID varchar(50) not null,
>     BIG_NUM numeric(20,0) not null
> );
> 
> INSERT INTO test_table (REQUEST_UUID, BIG_NUM) values ('TEST',
> 3691635539999999999);
> INSERT INTO test_table (REQUEST_UUID, BIG_NUM) values('TEST',
> 3691635530099999999);
> INSERT INTO test_table (REQUEST_UUID, BIG_NUM) values('TEST',
> 3691635530999999999);
> 
> SELECT BIG_NUM, FLOOR(BIG_NUM/10000000000),  BIG_NUM/10000000000 from
> test_table;

Well, your column definition has room for zero decimal places, so I'm
not sure this result is all that surprising.  Maybe you should cast the
column to one that has a few decimal places, say
  select bit_num::numeric(30,10) / 10000000000 from test_table;
and see whether that helps your case.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



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

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #15812: Select statement of a very big number, with a division operator seems to round up.
Следующее
От: Kaleb Akalework
Дата:
Сообщение: RE: BUG #15812: Select statement of a very big number, with adivision operator seems to round up.