Wrong results from in_range() tests with infinite offset
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@lists.postgresql.org
Cc: Dean Rasheed <dean.a.rasheed@gmail.com>
Date: 2020-07-16T18:58:13Z
Lists: pgsql-hackers
Attachments
- fix-infinite-in_range-cases.patch (text/x-diff) patch
Dean Rasheed pointed out that in_range for float4/float8 seems to be doing the wrong thing for infinite offsets, and after some testing I concur that it is. For example, a sort key of '-infinity' should be considered to be in-range for a range specified as RANGE BETWEEN 'inf' PRECEDING AND 'inf' PRECEDING; but with the code as it stands, it isn't. I propose the attached patch, which probably should be back-patched. When the current row's value is +infinity, actual computation of base - offset would yield NaN, making it a bit unclear whether we should consider -infinity to be in-range. It seems to me that we should, as that gives more natural-looking results in the test cases, so that's how the patch does it. regards, tom lane
Commits
-
Fix some corner cases for window ranges with infinite offsets.
- a4faef8f8fe1 14.0 landed