pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
[bug report] A sql statements make query hang
2+ messages / 2 participants
[nested] [flat]

* [bug report] A sql statements make query hang
@ 2020-01-06 06:39 Rui Zhong <reversezr33@gmail.com>
  2020-01-06 06:50 ` Re: [bug report] A sql statements make query hang Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Rui Zhong @ 2020-01-06 06:39 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org

Hi,


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;

-------


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


Best,

Yongheng & Rui

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [bug report] A sql statements make query hang
  2020-01-06 06:39 [bug report] A sql statements make query hang Rui Zhong <reversezr33@gmail.com>
@ 2020-01-06 06:50 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2020-01-06 06:50 UTC (permalink / raw)
  To: Rui Zhong <reversezr33@gmail.com>; +Cc: pgsql-bugs@lists.postgresql.org

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





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2020-01-06 06:50 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-01-06 06:39 [bug report] A sql statements make query hang Rui Zhong <reversezr33@gmail.com>
2020-01-06 06:50 ` Tom Lane <tgl@sss.pgh.pa.us>

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