Re: Range Types: empty ranges - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: Range Types: empty ranges
Date
Msg-id 1297455273.654.9.camel@jdavis-ux.asterdata.local
Whole thread Raw
In response to Re: Range Types: empty ranges  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Range Types: empty ranges  (Nathan Boley <npboley@gmail.com>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Replication server timeout patch
Next
From: Robert Haas
Date:
Subject: Re: Range Types: empty ranges