Re: Fixing r-tree semantics

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Fuhr <mike(at)fuhr(dot)org>, William White <bwhite(at)frognet(dot)net>, Teodor Sigaev <teodor(at)sigaev(dot)ru>, Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Fixing r-tree semantics
Date: 2005-06-24 04:38:34
Message-ID: 200506240438.j5O4cYa27904@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


FYI, TODO has:

* Fix incorrect rtree results due to wrong assumptions about "over"
operator semantics [rtree]

---------------------------------------------------------------------------

Tom Lane wrote:
> Hmmm ... just when you thought it was safe to go back in the water ...
>
> I was only looking closely at the "box" case earlier today, assuming
> that the polygon code was set up identically. Well, it isn't. In
> particular it appears that the poly_overleft and poly_overright
> definitions are different from box's, which means that rtrees are
> still broken for polygon searches.
>
> I'm of the opinion that this is a flat-out bug and we should just
> fix it, ie, change the operator definitions. The polygon definitions
> aren't even self-consistent (overleft accepts equality and overright
> doesn't).
>
> poly_left
> result = polya->boundbox.high.x < polyb->boundbox.low.x;
> poly_overleft:
> result = polya->boundbox.low.x <= polyb->boundbox.high.x;
> poly_right:
> result = polya->boundbox.low.x > polyb->boundbox.high.x;
> poly_overright:
> result = polya->boundbox.high.x > polyb->boundbox.low.x;
>
> By analogy to the box case these should be
>
> poly_overleft:
> result = polya->boundbox.high.x <= polyb->boundbox.high.x;
> poly_overright:
> result = polya->boundbox.low.x >= polyb->boundbox.low.x;
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Oleg Bartunov 2005-06-24 05:38:02 Re: Fixing r-tree semantics
Previous Message Robert Treat 2005-06-24 04:31:41 Re: pl/pgsql: END verbosity