From b90f8f20f035c3313f8a284346b5a1d155cfd2f0 Mon Sep 17 00:00:00 2001
From: Tom Lane
Date: Fri, 24 Jun 2005 20:53:34 +0000
Subject: Extend r-tree operator classes to handle Y-direction tests equivalent
to the existing X-direction tests. An rtree class now includes 4 actual 2-D
tests, 4 1-D X-direction tests, and 4 1-D Y-direction tests. This involved
adding four new Y-direction test operators for each of box and polygon; I
followed the PostGIS project's lead as to the names of these operators. NON
BACKWARDS COMPATIBLE CHANGE: the poly_overleft (&<) and poly_overright (&>)
operators now have semantics comparable to box_overleft and box_overright.
This is necessary to make r-tree indexes work correctly on polygons. Also, I
changed circle_left and circle_right to agree with box_left and box_right ---
formerly they allowed the boundaries to touch. This isn't actually essential
given the lack of any r-tree opclass for circles, but it seems best to sync
all the definitions while we are at it.
---
doc/src/sgml/func.sgml | 49 ++++++++++++++++++++++++++++++++++++++---------
doc/src/sgml/indices.sgml | 7 ++++++-
doc/src/sgml/xindex.sgml | 38 +++++++++++++++++++++++++++---------
3 files changed, 75 insertions(+), 19 deletions(-)
(limited to 'doc/src')
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 02ca4f896e3..8c7a48308ec 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -1,5 +1,5 @@
@@ -5854,6 +5854,17 @@ SELECT TIMESTAMP 'now'; -- incorrect for use with DEFAULT
linkend="functions-geometry-conv-table">.
+
+
+ Note that the same as> operator, ~=>, represents
+ the usual notion of equality for the point,
+ box, polygon, and circle types.
+ Some of these types also have an => operator, but it compares
+ for equal areas> only. The other scalar comparison operators
+ (<=> and so on) likewise compare areas for these types.
+
+
+
Geometric Operators
@@ -5920,6 +5931,16 @@ SELECT TIMESTAMP 'now'; -- incorrect for use with DEFAULT
Overlaps?
box '((0,0),(1,1))' && box '((0,0),(2,2))'
+
+ <<
+ Is strictly left of?
+ circle '((0,0),1)' << circle '((5,0),1)'
+
+
+ >>
+ Is strictly right of?
+ circle '((5,0),1)' >> circle '((0,0),1)'
+
&<
Does not extend to the right of?
@@ -5931,23 +5952,33 @@ SELECT TIMESTAMP 'now'; -- incorrect for use with DEFAULT
box '((0,0),(3,3))' &> box '((0,0),(2,2))'
- <<
- Is left of?
- circle '((0,0),1)' << circle '((5,0),1)'
+ <<|
+ Is strictly below?
+ box '((0,0),(3,3))' <<| box '((3,4),(5,5))'
- >>
- Is right of?
- circle '((5,0),1)' >> circle '((0,0),1)'
+ |>>
+ Is strictly above?
+ box '((3,4),(5,5))' |>> box '((0,0),(3,3))'
+
+
+ &<|
+ Does not extend above?
+ box '((0,0),(1,1))' &<| box '((0,0),(2,2))'
+
+
+ |&>
+ Does not extend below?
+ box '((0,0),(3,3))' |&> box '((0,0),(2,2))'
<^
- Is below?
+ Is below (allows touching)?
circle '((0,0),1)' <^ circle '((0,5),1)'
>^
- Is above?
+ Is above (allows touching)?
circle '((0,5),1)' >^ circle '((0,0),1)'
diff --git a/doc/src/sgml/indices.sgml b/doc/src/sgml/indices.sgml
index 41f87d60f66..3bb530b60e8 100644
--- a/doc/src/sgml/indices.sgml
+++ b/doc/src/sgml/indices.sgml
@@ -1,4 +1,4 @@
-
+
Indexes
@@ -177,6 +177,11 @@ CREATE INDEX name ON table
&<
&>
>>
+ <<|
+ &<|
+ |&>
+ |>>
+ ~
@
~=
&&
diff --git a/doc/src/sgml/xindex.sgml b/doc/src/sgml/xindex.sgml
index 0b254324485..5764198e271 100644
--- a/doc/src/sgml/xindex.sgml
+++ b/doc/src/sgml/xindex.sgml
@@ -1,5 +1,5 @@
@@ -169,8 +169,12 @@ $PostgreSQL: pgsql/doc/src/sgml/xindex.sgml,v 1.39 2005/02/13 03:04:15 tgl Exp $
- R-tree indexes express rectangle-containment relationships.
- They use eight strategies, shown in .
+ R-tree indexes express relationships in two-dimensional space.
+ They use twelve strategies, shown in
+ . Four of these are true
+ two-dimensional tests (overlaps, same, contains, contained by);
+ four of them consider only the X direction; and the other four
+ provide the same tests in the Y direction.
@@ -184,23 +188,23 @@ $PostgreSQL: pgsql/doc/src/sgml/xindex.sgml,v 1.39 2005/02/13 03:04:15 tgl Exp $
- left of
+ strictly left of
1
- left of or overlapping
+ does not extend to right of
2
- overlapping
+ overlaps
3
- right of or overlapping
+ does not extend to left of
4
- right of
+ strictly right of
5
@@ -215,6 +219,22 @@ $PostgreSQL: pgsql/doc/src/sgml/xindex.sgml,v 1.39 2005/02/13 03:04:15 tgl Exp $
contained by
8
+
+ does not extend above
+ 9
+
+
+ strictly below
+ 10
+
+
+ strictly above
+ 11
+
+
+ does not extend below
+ 12
+
@@ -398,7 +418,7 @@ $PostgreSQL: pgsql/doc/src/sgml/xindex.sgml,v 1.39 2005/02/13 03:04:15 tgl Exp $
Unlike strategy operators, support functions return whichever data
- type the particular index method expects, for example in the case
+ type the particular index method expects; for example in the case
of the comparison function for B-trees, a signed integer.
--
cgit v1.2.3