Re: Infinite Interval
Joseph Koshakow <koshy44@gmail.com>
From: Joseph Koshakow <koshy44@gmail.com>
To: jian he <jian.universality@gmail.com>
Cc: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-01-07T20:05:14Z
Lists: pgsql-hackers
Attachments
- v9-0001-Support-infinite-interval.patch (text/x-patch) patch v9-0001
On Sat, Jan 7, 2023 at 3:04 PM Joseph Koshakow <koshy44@gmail.com> wrote: > > On Thu, Jan 5, 2023 at 11:30 PM jian he <jian.universality@gmail.com> wrote: > > > > > > > > On Fri, Jan 6, 2023 at 6:54 AM Joseph Koshakow <koshy44@gmail.com> wrote: > >> > >> Looks like some of the error messages have changed and we > >> have some issues with parsing "+infinity" after rebasing. > > > > > > There is a commit 2ceea5adb02603ef52579b568ca2c5aebed87358 > > https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=2ceea5adb02603ef52579b568ca2c5aebed87358 > > if you pull this commit then you can do select interval '+infinity', even though I don't know why. > > It turns out that I was just misreading the error. The test was > expecting us to fail on "+infinity" but we succeeded. I just removed > that test case. > > >> pgindent. Looks like some of the error messages have changed > > The conditions for checking valid addition/subtraction between infinite > values were missing some cases which explains the change in error > messages. I've updated the logic and removed duplicate checks. > > I removed the extract/date_part tests since they were duplicated in a > test above. I also converted the DO command tests to using SQL with > joins so it more closely matches the existing tests. > > I've updated the extract/date_part logic for infinite intervals. Fields > that are monotonically increasing should return +/-infinity and all > others should return NULL. For Intervals, the fields are the same as > timestamps plus the hour and day fields since those don't overflow into > the next highest field. > > I think this patch is just about ready for review, except for the > following two questions: > 1. Should finite checks on intervals only look at months or all three > fields? > 2. Should we make the error messages for adding/subtracting infinite > values more generic or leave them as is? > > My opinions are > 1. We should only look at months. > 2. We should make the errors more generic. > > Anyone else have any thoughts? > > - Joe Oops I forgot the actual patch. Please see attached.
Commits
-
Support +/- infinity in the interval data type.
- 519fc1bd9e9d 17.0 landed
-
Avoid integer overflow hazard in interval_time().
- 3850d4dec1d9 17.0 landed
-
Guard against overflow in make_interval().
- b2d55447a563 17.0 landed
-
Fix minmax-multi on infinite date/timestamp values
- 8da86d62a112 17.0 cited
-
Optimize various aggregate deserialization functions, take 2
- 0c882a298881 17.0 cited
-
Remove dead code in DecodeInterval()
- d6d1430f4043 17.0 cited
-
Accept "+infinity" in date and timestamp[tz] input.
- 2ceea5adb026 16.0 cited
-
Fix overflow hazards in interval input and output conversions.
- e39f99046710 15.0 cited