Re: time values past 24:00:00 (or rather 23:59:60)
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Christoph Berg <myon@debian.org>
Cc: PostgreSQL Bugs <pgsql-bugs@postgresql.org>
Date: 2020-05-21T05:53:01Z
Lists: pgsql-bugs
Attachments
- handle-maximum-time-of-day-better.patch (text/x-diff) patch
Christoph Berg <myon@debian.org> writes: > This is not ok: > # select '23:59:60.999'::time; > time > -------------- > 24:00:00.999 Yeah. Here's a draft patch for that (sans any regression tests as yet). I found several places with largely the same logic, so I tried to centralize the tests; although it turns out we need a minimum of two versions, because some places deal with fractional seconds differently. The places using float seconds had their own bugs: one forgot to worry about NaN, and neither was being careful about imprecise input. It's slightly annoying to have the check functions duplicate the calculation that some level of caller is going to do, but avoiding that would take more refactoring than I think is warranted. In practice a few extra multiplications aren't likely to be noticeable here. regards, tom lane
Commits
-
Reject "23:59:60.nnn" in datetime input.
- a9632830bb05 13.0 landed
- b2c64f571db4 10.14 landed
- a958b07bc453 12.4 landed
- 6490376e56b0 11.9 landed