On Fri, 2011-02-11 at 14:14 -0500, Robert Haas wrote:
> > It's really that it has nice mathematical properties coming from set
> > theory. Take the distributive law:
> >
> > A UNION (B INTERSECT C) = (A UNION B) INTERSECT (A UNION C)
>
> But the basic range type isn't even closed under UNION.
An excellent point. Allow me to move the target a little:
WHERE A && B AND A && C
and: WHERE A && (B INTERSECT C)
That seems like a logically sound transformation, but if (B INTERSECT C)
is empty, it relies on the empty range for those two to be equivalent.
And that would be a runtime error, caught during testing only if you're
lucky.
Now, I agree that lack of closure on UNION exhibits many of the problems
that I am pointing out related to forbidding empty ranges. However, I'm
not sure if that means we should give up on either.
Regards,Jeff Davis