BUG #15692: infinity loop

Started by PG Bug reporting formabout 7 years ago5 messagesbugs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

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.

#2Shulgin, Oleksandr
oleksandr.shulgin@zalando.de
In reply to: PG Bug reporting form (#1)
Re: BUG #15692: infinity loop

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

In reply to: PG Bug reporting form (#1)
Re: BUG #15692: infinity loop

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

#4Dean Rasheed
dean.a.rasheed@gmail.com
In reply to: Sergei Kornilov (#3)
Re: BUG #15692: infinity loop

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

#5Alisher Aliev
allyanaliev@gmail.com
In reply to: Dean Rasheed (#4)
Re: BUG #15692: infinity loop

Thanks for replying

On Wed, 13 Mar 2019, 14:43 Dean Rasheed, <dean.a.rasheed@gmail.com> wrote:

Show quoted text

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