Florian Pflug <fgp(at)phlo(dot)org> writes:
> More formally, let there be two arbitrary ranges
> where the first two parameters are the lower respectively upper bound, and
> the last two are booleans saying whether the lower respectively upper bound
> is inclusive (true) or exclusive (false).
> These ranges are then adjacent exactly if the range
> is empty.
I tried to implement this, and I think it has a small bug. It works as
stated if we have b < c. However, if we have b == c, then we want to
consider the ranges adjacent if i_b != i_c (ie, only one of them claims
the common boundary point). But a singleton range is empty unless it's
inclusive on both sides. So we have to have a special case when the
bounds are equal.
(If b > c, then of course we have to consider the two ranges in the
Attached is a draft patch for this. It passes regression tests but I've
not tried to exercise it with a canonical function that actually does
something different. It's going to be a bit slower than Jeff's
original, because it does not only range_cmp_bound_values but also a
make_range cycle (in most cases). So I guess the question is how much
we care about supporting canonical functions with non-default policies.
regards, tom lane
In response to
pgsql-hackers by date
|Next:||From: Tom Lane||Date: 2011-11-23 03:28:14|
|Subject: Re: Permissions checks for range-type support functions |
|Previous:||From: Peter Geoghegan||Date: 2011-11-23 01:09:23|
|Subject: Re: Inlining comparators as a performance optimisation|