Обсуждение: BUG #15692: infinity loop

Поиск
Список
Период
Сортировка

BUG #15692: infinity loop

От
PG Bug reporting form
Дата:
The following bug has been logged on the website:

Bug reference:      15692
Logged by:          Alisher Aliev
Email address:      allyanaliev@gmail.com
PostgreSQL version: Unsupported/Unknown
Operating system:   CentOS Linux 7
Description:

create table numer (n numeric);
insert into numer values (1);
insert into numer values (2);
insert into numer values (3);
select * from numer;
update numer set n = n * 10;
update numer set n = n * 7777777777777777777777777;
update numer set n = n ^ 1000;
update numer set n = n ^ 1000;

At last command PostgreSQL comming inside infinity loop.


Re: BUG #15692: infinity loop

От
Oleksandr Shulgin
Дата:
On Wed, Mar 13, 2019 at 11:21 AM PG Bug reporting form <noreply@postgresql.org> wrote:
The following bug has been logged on the website:

Bug reference:      15692
Logged by:          Alisher Aliev
Email address:      allyanaliev@gmail.com
PostgreSQL version: Unsupported/Unknown
Operating system:   CentOS Linux 7
Description:       

create table numer (n numeric);
insert into numer values (1);
insert into numer values (2);
insert into numer values (3);
select * from numer;
update numer set n = n * 10;
update numer set n = n * 7777777777777777777777777;
update numer set n = n ^ 1000;
update numer set n = n ^ 1000;

At last command PostgreSQL comming inside infinity loop.

How long the "infinity" lasts depends on how fast your hardware is (assuming you do have enough memory to hold the result).
Which behavior did you expect?  You asked the system to calculate the answer precisely, which is going to be a really long number, it's going to take some time to get you the answer.
If imprecise answer is an option, you could use floating point data type instead, like "double precision".

Regards,
--
Alex

Re: BUG #15692: infinity loop

От
Sergei Kornilov
Дата:
Hi

> At last command PostgreSQL comming inside infinity loop.

I have message "ERROR:  value overflows numeric format" very quickly for both 11.2 and HEAD versions.

regards, Sergei


Re: BUG #15692: infinity loop

От
Dean Rasheed
Дата:
On Wed, 13 Mar 2019 at 11:04, Sergei Kornilov <sk@zsrv.org> wrote:
>
> > At last command PostgreSQL comming inside infinity loop.
>
> I have message "ERROR:  value overflows numeric format" very quickly for both 11.2 and HEAD versions.
>

Yeah, in any modern Postgres (9.6 or later) this calculation fails
with a numeric overflow in less than a millisecond for me. That's
consistent with the fact that numeric calculations were improved
somewhat in 9.6.

In older versions (9.0 - 9.5 inclusive), which includes 4 old
unsupported versions, it takes a little over a second to fail.
Certainly not an "infinity loop".

In really old versions (I tested 8.3 and 8.4) it does indeed appear to
go into an near-infinite loop, but frankly, anyone running 8.4 or
older has bigger problems.

Regards,
Dean


Re: BUG #15692: infinity loop

От
Alisher Aliev
Дата:
Thanks for replying

On Wed, 13 Mar 2019, 14:43 Dean Rasheed, <dean.a.rasheed@gmail.com> wrote:
On Wed, 13 Mar 2019 at 11:04, Sergei Kornilov <sk@zsrv.org> wrote:
>
> > At last command PostgreSQL comming inside infinity loop.
>
> I have message "ERROR:  value overflows numeric format" very quickly for both 11.2 and HEAD versions.
>

Yeah, in any modern Postgres (9.6 or later) this calculation fails
with a numeric overflow in less than a millisecond for me. That's
consistent with the fact that numeric calculations were improved
somewhat in 9.6.

In older versions (9.0 - 9.5 inclusive), which includes 4 old
unsupported versions, it takes a little over a second to fail.
Certainly not an "infinity loop".

In really old versions (I tested 8.3 and 8.4) it does indeed appear to
go into an near-infinite loop, but frankly, anyone running 8.4 or
older has bigger problems.

Regards,
Dean