Query generates infinite loop

Richard Wesley <richard@duckdblabs.com>

From: Richard Wesley <richard@duckdblabs.com>
To: pgsql-bugs@lists.postgresql.org
Date: 2022-04-20T16:17:32Z
Lists: pgsql-bugs, pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Revert "Disallow infinite endpoints in generate_series() for timestamps."

  2. Disallow infinite endpoints in generate_series() for timestamps.

Hi All -

I was implementing the infinity time constants in DuckDB when I ran into an infinite loop. It seems that PG has the same problem for the same reason (adding an interval to an infinite timestamp produces the same timestamp, so the increment operation never goes anywhere.)  Here is the query:
select COUNT(*) 
FROM generate_series('-infinity'::TIMESTAMP, 'epoch'::TIMESTAMP, 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 anyway.


Met vriendelijke groet, best regards, mit freundlichen Grüßen,
Richard Wesley
Group-By Therapist
richard@duckdblabs.com <mailto:richard@duckdblabs.com>