mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
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.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.258 2005/06/15 06:29:25 neilc Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.259 2005/06/24 20:53:29 tgl Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@ -5854,6 +5854,17 @@ SELECT TIMESTAMP 'now'; -- incorrect for use with DEFAULT
|
||||
linkend="functions-geometry-conv-table">.
|
||||
</para>
|
||||
|
||||
<caution>
|
||||
<para>
|
||||
Note that the <quote>same as</> operator, <literal>~=</>, represents
|
||||
the usual notion of equality for the <type>point</type>,
|
||||
<type>box</type>, <type>polygon</type>, and <type>circle</type> types.
|
||||
Some of these types also have an <literal>=</> operator, but it compares
|
||||
for equal <emphasis>areas</> only. The other scalar comparison operators
|
||||
(<literal><=</> and so on) likewise compare areas for these types.
|
||||
</para>
|
||||
</caution>
|
||||
|
||||
<table id="functions-geometry-op-table">
|
||||
<title>Geometric Operators</title>
|
||||
<tgroup cols="3">
|
||||
@ -5920,6 +5931,16 @@ SELECT TIMESTAMP 'now'; -- incorrect for use with DEFAULT
|
||||
<entry>Overlaps?</entry>
|
||||
<entry><literal>box '((0,0),(1,1))' && box '((0,0),(2,2))'</literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry> <literal><<</literal> </entry>
|
||||
<entry>Is strictly left of?</entry>
|
||||
<entry><literal>circle '((0,0),1)' << circle '((5,0),1)'</literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry> <literal>>></literal> </entry>
|
||||
<entry>Is strictly right of?</entry>
|
||||
<entry><literal>circle '((5,0),1)' >> circle '((0,0),1)'</literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry> <literal>&<</literal> </entry>
|
||||
<entry>Does not extend to the right of?</entry>
|
||||
@ -5931,23 +5952,33 @@ SELECT TIMESTAMP 'now'; -- incorrect for use with DEFAULT
|
||||
<entry><literal>box '((0,0),(3,3))' &> box '((0,0),(2,2))'</literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry> <literal><<</literal> </entry>
|
||||
<entry>Is left of?</entry>
|
||||
<entry><literal>circle '((0,0),1)' << circle '((5,0),1)'</literal></entry>
|
||||
<entry> <literal><<|</literal> </entry>
|
||||
<entry>Is strictly below?</entry>
|
||||
<entry><literal>box '((0,0),(3,3))' <<| box '((3,4),(5,5))'</literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry> <literal>>></literal> </entry>
|
||||
<entry>Is right of?</entry>
|
||||
<entry><literal>circle '((5,0),1)' >> circle '((0,0),1)'</literal></entry>
|
||||
<entry> <literal>|>></literal> </entry>
|
||||
<entry>Is strictly above?</entry>
|
||||
<entry><literal>box '((3,4),(5,5))' |>> box '((0,0),(3,3))'</literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry> <literal>&<|</literal> </entry>
|
||||
<entry>Does not extend above?</entry>
|
||||
<entry><literal>box '((0,0),(1,1))' &<| box '((0,0),(2,2))'</literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry> <literal>|&></literal> </entry>
|
||||
<entry>Does not extend below?</entry>
|
||||
<entry><literal>box '((0,0),(3,3))' |&> box '((0,0),(2,2))'</literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry> <literal><^</literal> </entry>
|
||||
<entry>Is below?</entry>
|
||||
<entry>Is below (allows touching)?</entry>
|
||||
<entry><literal>circle '((0,0),1)' <^ circle '((0,5),1)'</literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry> <literal>>^</literal> </entry>
|
||||
<entry>Is above?</entry>
|
||||
<entry>Is above (allows touching)?</entry>
|
||||
<entry><literal>circle '((0,5),1)' >^ circle '((0,0),1)'</literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/indices.sgml,v 1.50 2005/01/22 22:56:36 momjian Exp $ -->
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/indices.sgml,v 1.51 2005/06/24 20:53:30 tgl Exp $ -->
|
||||
|
||||
<chapter id="indexes">
|
||||
<title id="indexes-title">Indexes</title>
|
||||
@ -177,6 +177,11 @@ CREATE INDEX <replaceable>name</replaceable> ON <replaceable>table</replaceable>
|
||||
<member><literal>&<</literal></member>
|
||||
<member><literal>&></literal></member>
|
||||
<member><literal>>></literal></member>
|
||||
<member><literal><<|</literal></member>
|
||||
<member><literal>&<|</literal></member>
|
||||
<member><literal>|&></literal></member>
|
||||
<member><literal>|>></literal></member>
|
||||
<member><literal>~</literal></member>
|
||||
<member><literal>@</literal></member>
|
||||
<member><literal>~=</literal></member>
|
||||
<member><literal>&&</literal></member>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/xindex.sgml,v 1.39 2005/02/13 03:04:15 tgl Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/xindex.sgml,v 1.40 2005/06/24 20:53:30 tgl Exp $
|
||||
-->
|
||||
|
||||
<sect1 id="xindex">
|
||||
@ -169,8 +169,12 @@ $PostgreSQL: pgsql/doc/src/sgml/xindex.sgml,v 1.39 2005/02/13 03:04:15 tgl Exp $
|
||||
</table>
|
||||
|
||||
<para>
|
||||
R-tree indexes express rectangle-containment relationships.
|
||||
They use eight strategies, shown in <xref linkend="xindex-rtree-strat-table">.
|
||||
R-tree indexes express relationships in two-dimensional space.
|
||||
They use twelve strategies, shown in
|
||||
<xref linkend="xindex-rtree-strat-table">. 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.
|
||||
</para>
|
||||
|
||||
<table tocentry="1" id="xindex-rtree-strat-table">
|
||||
@ -184,23 +188,23 @@ $PostgreSQL: pgsql/doc/src/sgml/xindex.sgml,v 1.39 2005/02/13 03:04:15 tgl Exp $
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>left of</entry>
|
||||
<entry>strictly left of</entry>
|
||||
<entry>1</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>left of or overlapping</entry>
|
||||
<entry>does not extend to right of</entry>
|
||||
<entry>2</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>overlapping</entry>
|
||||
<entry>overlaps</entry>
|
||||
<entry>3</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>right of or overlapping</entry>
|
||||
<entry>does not extend to left of</entry>
|
||||
<entry>4</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>right of</entry>
|
||||
<entry>strictly right of</entry>
|
||||
<entry>5</entry>
|
||||
</row>
|
||||
<row>
|
||||
@ -215,6 +219,22 @@ $PostgreSQL: pgsql/doc/src/sgml/xindex.sgml,v 1.39 2005/02/13 03:04:15 tgl Exp $
|
||||
<entry>contained by</entry>
|
||||
<entry>8</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>does not extend above</entry>
|
||||
<entry>9</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>strictly below</entry>
|
||||
<entry>10</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>strictly above</entry>
|
||||
<entry>11</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>does not extend below</entry>
|
||||
<entry>12</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
@ -398,7 +418,7 @@ $PostgreSQL: pgsql/doc/src/sgml/xindex.sgml,v 1.39 2005/02/13 03:04:15 tgl Exp $
|
||||
|
||||
<para>
|
||||
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.
|
||||
</para>
|
||||
</sect2>
|
||||
|
Reference in New Issue
Block a user