Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ioMDo-0007rr-Im for pgsql-bugs@arkaria.postgresql.org; Mon, 06 Jan 2020 06:50:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ioMDn-0005VF-CX for pgsql-bugs@arkaria.postgresql.org; Mon, 06 Jan 2020 06:50:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ioMDn-0005V7-4i for pgsql-bugs@lists.postgresql.org; Mon, 06 Jan 2020 06:50:39 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ioMDk-000076-Uj for pgsql-bugs@lists.postgresql.org; Mon, 06 Jan 2020 06:50:38 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 0066oXJ4004139; Mon, 6 Jan 2020 01:50:33 -0500 From: Tom Lane To: Rui Zhong cc: pgsql-bugs@lists.postgresql.org Subject: Re: [bug report] A sql statements make query hang In-reply-to: References: Comments: In-reply-to Rui Zhong message dated "Mon, 06 Jan 2020 01:39:39 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4137.1578293433.1@sss.pgh.pa.us> Date: Mon, 06 Jan 2020 01:50:33 -0500 Message-ID: <4138.1578293433@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Rui Zhong 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