From: Tom Lane <tgl@sss.pgh.pa.us>
To: Rui Zhong <reversezr33@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: [bug report] A sql statements make query hang
Date: Mon, 06 Jan 2020 01:50:33 -0500
Message-ID: <4138.1578293433@sss.pgh.pa.us> (raw)
In-Reply-To: <CAHooS4yJmdjLiO98XubApVimAsU0SGa1tMmunwfJTiLj6Uu1DA@mail.gmail.com>
References: <CAHooS4yJmdjLiO98XubApVimAsU0SGa1tMmunwfJTiLj6Uu1DA@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, reversezr33@gmail.com
Subject: Re: [bug report] A sql statements make query hang
In-Reply-To: <4138.1578293433@sss.pgh.pa.us>
References: <CAHooS4yJmdjLiO98XubApVimAsU0SGa1tMmunwfJTiLj6Uu1DA@mail.gmail.com> <4138.1578293433@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox