On Tuesday, 9 January 2018, Tom Lane <
tgl@sss.pgh.pa.us> wrote:
So the approach I'm imagining now is a datatype-specific support function
along the lines of
in_range(a, b, delta) returns bool
which is supposed to return true if a <= b + delta, or something along
that line --- exact details of the definition TBD --- with the proviso
that if b + delta would overflow then the result is automatically true.
We could probably also delegate the requirement of throwing an error
for negative delta to this function, eliminating the need for the
datatype-independent core code to know how to tell that, which is the
other datatype-dependent behavior needed per spec.
Likely there are two of these, one each for the PRECEDING and FOLLOWING
cases.
Would you prefer two functions, or a single function with a parameter for PRECEDING/FOLLOWING? Maybe:
in_range(a, b, delta, following) returns bool
Where following is a bool which is true if FOLLOWING was specified and false if PRECEDING was specified?