From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Jakob Teuber <jakob(dot)teuber(at)tum(dot)de> |
Cc: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Infinite loop for generate_series with timestamp arguments |
Date: | 2025-03-03 21:30:21 |
Message-ID: | 4081027.1741037421@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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 results in different months.
> Another idea is to check, after doing each addition, to make
> sure that the timestamp actually advanced in the expected
> direction. But should we error out if not, or just stop?
Here's a very POC-y patch using both of these ideas (and
choosing to error out if the interval changes sign).
If we go this way, generate_series_timestamptz would need
similar changes, and some regression test cases would be
appropriate. I'm not sure if the documentation needs
adjustment; it doesn't talk about the difficulty of
identifying the sign of an interval.
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
guard-against-interval-sign-changes-wip.patch | text/x-diff | 2.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | chandan Kumar | 2025-03-04 08:56:34 | Review my steps for rollback to restore point |
Previous Message | Tom Lane | 2025-03-03 19:10:46 | Re: Infinite loop for generate_series with timestamp arguments |