Re: Infinite loop for generate_series with timestamp arguments

2025-03-03 Thread Tom Lane
I wrote: > We could perhaps do better by doing the initial addition of the > interval and seeing if that produces a value greater than, less > than, or equal to the start timestamp. But I'm afraid that > doesn't move the goalposts very far, because as this example > shows, we might get different r

Re: Infinite loop for generate_series with timestamp arguments

2025-03-03 Thread Tom Lane
Jakob Teuber writes: > I noticed, that the following query will send Postgres into an infinite > loop: > (a)  select generate_series(timestamp '2025-01-30', timestamp > '2025-02-01', interval '1 month -29 days'); > One could certainly argue that “go and do an infinite loop” is plainly > the int

Infinite loop for generate_series with timestamp arguments

2025-03-03 Thread Jakob Teuber
Hi all, I noticed, that the following query will send Postgres into an infinite loop: (a)  select generate_series(timestamp '2025-01-30', timestamp '2025-02-01', interval '1 month -29 days'); Adding one month to 2023-01-30 will result in 2023-02-28 due to February having no 31st day, and t