Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nhDk8-0005TU-SF for pgsql-bugs@arkaria.postgresql.org; Wed, 20 Apr 2022 17:03:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nhDk6-0004QR-R9 for pgsql-bugs@arkaria.postgresql.org; Wed, 20 Apr 2022 17:03:50 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nhDk6-0004QD-Io for pgsql-bugs@lists.postgresql.org; Wed, 20 Apr 2022 17:03:50 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nhDk3-0001sD-7D for pgsql-bugs@lists.postgresql.org; Wed, 20 Apr 2022 17:03:48 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 23KH3j7e2842829; Wed, 20 Apr 2022 13:03:45 -0400 From: Tom Lane To: Pavel Stehule cc: Richard Wesley , PostgreSQL mailing lists Subject: Re: Query generates infinite loop In-reply-to: References: <91B44E7B-68D5-448F-95C8-B4B3B0F5DEAF@duckdblabs.com> Comments: In-reply-to Pavel Stehule message dated "Wed, 20 Apr 2022 18:53:33 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <2842827.1650474225.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 20 Apr 2022 13:03:45 -0400 Message-ID: <2842828.1650474225@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Pavel Stehule writes: > st 20. 4. 2022 v 18:42 odes=C3=ADlatel Richard Wesley > napsal: >> select COUNT(*) FROM generate_series('-infinity'::TIMESTAMP, 'epoch'::T= IMESTAMP, INTERVAL '1 DAY'); >> >> This seems like a DoS great attack, so we are disallowing infinities as >> bounds for both table and scalar series generation. As an upper bound, = it >> eventually gives an error, so it seems there is not much utility anywa= y. > There are more ways to achieve the same effect. The protection is safe > setting of temp_file_limit Well, there are any number of ways to DOS a database you can issue arbitrary queries to. For instance, cross joining a number of very large tables. So I'm not excited about that aspect of it. Still, it's true that infinities as generate_series endpoints are going to work pretty oddly, so I agree with the idea of forbidding 'em. Numeric has infinity as of late, so the numeric variant would need to do this too. I think we can allow infinity as the step, though. regards, tom lane