Re: [bug report] A sql statements make query hang

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rui Zhong <reversezr33(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: [bug report] A sql statements make query hang
Date: 2020-01-06 06:50:33
Message-ID: 4138.1578293433@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Rui Zhong <reversezr33(at)gmail(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Fabien COELHO 2020-01-06 07:47:34 Re: BUG #16186: The usage of undefined value in pgbench.c
Previous Message Michael Paquier 2020-01-06 06:49:18 Re: BUG #16190: The usage of NULL pointer in refint.c