Re: Range Types: empty ranges

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Range Types: empty ranges
Date: 2011-02-11 20:14:33
Message-ID: 1297455273.654.9.camel@jdavis-ux.asterdata.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-02-11 20:14:41 Re: Range Types: empty ranges
Previous Message Robert Haas 2011-02-11 20:11:38 Re: Replication server timeout patch