Re: Comments on Exclusion Constraints and related datatypes

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: David Fetter <david(at)fetter(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Comments on Exclusion Constraints and related datatypes
Date: 2010-03-22 20:02:53
Message-ID: 1269288173.8481.1778.camel@ebony
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 2010-03-22 at 10:55 -0700, David Fetter wrote:
> On Mon, Mar 22, 2010 at 01:46:51PM -0400, Tom Lane wrote:
> > David Fetter <david(at)fetter(dot)org> writes:
> > > I'm seeing a lot of places where this might be documented. Any ideas
> > > as to which ones are appropriate?
> >
> > I would think "Geometric Functions and Operators" would be the most
> > appropriate spot ...
>
> Please find patch enclosed. :)

I think you've missed my point. I don't suppose anybody would disagree
that box '((0,0),(1,1))' && box '((0,0),(2,2))' is true. The fact that
these two boxes share the point (0,0) has nothing to do with the obvious
fact that the larger box completely contains the smaller one.

What I was talking about was that box '((0,0),(1,1))' && box
'((1,1),(2,2))' returns true, even though they touch at only a single
point, and share zero area.

Perhaps the end result here is the realisation that a normal search
operator like overlaps (&&) might not be the right operator to use for
exclusion constraints. For the latter, we might want something that
defines the left and bottom edges of a box to belong to the box (>=),
whereas the top edges are the boundary but do not belong to the box
itself (<). In a timerange that might be easier to visualise: the start
timestamp is inclusive, the end timestamp is exclusive, so that each
timestamp exists in only one timerange when the timeranges are
overlapping with no gaps.

--
Simon Riggs www.2ndQuadrant.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2010-03-22 20:10:31 Re: Comments on Exclusion Constraints and related datatypes
Previous Message Greg Stark 2010-03-22 19:46:54 Re: Comments on Exclusion Constraints and related datatypes