BUG #17876: Function width_bucket() for float8 input returns value out of range

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #17876: Function width_bucket() for float8 input returns value out of range
Дата
Msg-id 17876-61f280d1601f978d@postgresql.org
обсуждение исходный текст
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      17876
Logged by:          Mats Kindahl
Email address:      mats@timescale.com
PostgreSQL version: 15.2
Operating system:   All
Description:

On 64-bit platforms, the existing width_bucket() computation can
result in a NaN (0x8000000) if the difference between the `operand`,
`low`, or `high` parameters exceeds DBL_MAX. This is then cast to the
value -2147483648.

    mats=# WITH sample(operand, low, high, cnt) AS (
      VALUES 
    (10.5::float8, -1.797e+308::float8, 1.797e+308::float8, 1::int4),
    (10.5::float8, -1.797e+308::float8, 1.797e+308::float8, 2),
    (10.5::float8, -1.797e+308::float8, 1.797e+308::float8, 3),

    (1.797e+308::float8 / 2, -1.797e+308::float8, 1.797e+308::float8, 10),
    (-1.797e+308::float8 / 2, -1.797e+308::float8, 1.797e+308::float8, 10),

    (1.797e+308::float8 / 2, -1.797e+308::float8, 1.797e+308::float8, 16),
    (-1.797e+308::float8 / 2, -1.797e+308::float8, 1.797e+308::float8, 16),

    (1.797e+308::float8, -1.797e+308::float8 / 2, 1.797e+308::float8 / 2,
10),
    (-1.797e+308::float8, -1.797e+308::float8 / 2, 1.797e+308::float8 / 2,
10)
    ) SELECT width_bucket(operand, low, high, cnt) FROM sample;
     width_bucket 
    --------------
        1
      -2147483648
      -2147483648
      -2147483648
      -2147483648
      -2147483648
      -2147483648
           11
        0
    (9 rows)


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

Предыдущее
От: Amit Regmi
Дата:
Сообщение: Re: NEED RPM FILE OF LATEST POSTGRE supported for AIX 7.2
Следующее
От: Mats Kindahl
Дата:
Сообщение: Re: BUG #17876: Function width_bucket() for float8 input returns value out of range