Re: [bug report] A sql statements make query hang - Mailing list pgsql-bugs

From Tom Lane
Subject Re: [bug report] A sql statements make query hang
Date
Msg-id 4138.1578293433@sss.pgh.pa.us
Whole thread Raw
In response to [bug report] A sql statements make query hang  (Rui Zhong <reversezr33@gmail.com>)
List pgsql-bugs
Rui Zhong <reversezr33@gmail.com> writes:
> When we run follow statements make query hang and never return in
> PostgreSQL 13devel, we consider it might be a bug of PostgreSQL and report
> it.

> CREATE TEMPORARY TABLE v0 ( v1 INT UNIQUE ) ;

> WITH RECURSIVE v0 ( v1 ) AS ( SELECT -128 UNION SELECT v1 + 33 FROM v0 )
> SELECT 'x' from v0;

That's an infinite recursion, so I'm not sure why you think there's
a server bug here.

In practice, I think you'd get an integer overflow error after
awhile, where "awhile" is defined as INT_MAX/33 recursions.
It might take considerable patience to reach that point though.
(And when you did, it still wouldn't be a bug.  The calculation
specified by this query must eventually overflow any finite
arithmetic.)

> When we run in mysql, it suddenly return an empty set.

Hardly requires commentary.

            regards, tom lane



pgsql-bugs by date:

Previous
From: Michael Paquier
Date:
Subject: Re: BUG #16190: The usage of NULL pointer in refint.c
Next
From: Fabien COELHO
Date:
Subject: Re: BUG #16186: The usage of undefined value in pgbench.c