Hi, On 2018-02-25 01:30:47 +0100, Tomas Vondra wrote: > Note: Currently, this only works with float8-based data types. > Supporting additional data types is not a big issue, but will > require extending the opclass with "subtract" operator (used to > compute distance between values when merging ranges).
Based on Tom's past stances I'm a bit doubtful he'd be happy with such a restriction. Note that something similar-ish also has come up in 0a459cec96. I kinda wonder if there's any way to not have two similar but not equal types of logic here? That problem is resolved here by adding the ability for btree operator classes to provide an "in_range" support function that defines how to add or subtract the RANGE offset value. Factoring it this way also allows the operator class to avoid overflow problems near the ends of the datatype's range, if it wishes to expend effort on that. (In the committed patch, the integer opclasses handle that issue, but it did not seem worth the trouble to avoid overflow failures for datetime types.) - Andres