/*-------------------------------------------------------------------------
*
* rtree_gist.c
- * pg_amproc entries for GiSTs over 2-D boxes.
+ * pg_amproc entries for GiSTs over 2-D boxes and polygons.
*
* This gives R-tree behavior, with Guttman's poly-time split algorithm.
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/contrib/rtree_gist/rtree_gist.c,v 1.13 2005/06/24 00:18:52 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/rtree_gist/rtree_gist.c,v 1.14 2005/06/24 20:53:29 tgl Exp $
*
*-------------------------------------------------------------------------
*/
typedef float (*SIZE_BOX) (Datum);
/*
-** box ops
-*/
+ * box ops
+ */
PG_FUNCTION_INFO_V1(gbox_compress);
PG_FUNCTION_INFO_V1(gbox_union);
PG_FUNCTION_INFO_V1(gbox_picksplit);
static float size_box(Datum box);
/*
-** Polygon ops
-*/
+ * Polygon ops
+ */
PG_FUNCTION_INFO_V1(gpoly_compress);
PG_FUNCTION_INFO_V1(gpoly_consistent);
Datum gpoly_consistent(PG_FUNCTION_ARGS);
/*
-** Common rtree-function (for all ops)
-*/
+ * Common rtree-function (for all ops)
+ */
static bool rtree_internal_consistent(BOX *key, BOX *query, StrategyNumber strategy);
PG_FUNCTION_INFO_V1(rtree_decompress);
case RTContainedByStrategyNumber:
retval = DatumGetBool(DirectFunctionCall2(box_contained, PointerGetDatum(key), PointerGetDatum(query)));
break;
+ case RTOverBelowStrategyNumber:
+ retval = DatumGetBool(DirectFunctionCall2(box_overbelow, PointerGetDatum(key), PointerGetDatum(query)));
+ break;
+ case RTBelowStrategyNumber:
+ retval = DatumGetBool(DirectFunctionCall2(box_below, PointerGetDatum(key), PointerGetDatum(query)));
+ break;
+ case RTAboveStrategyNumber:
+ retval = DatumGetBool(DirectFunctionCall2(box_above, PointerGetDatum(key), PointerGetDatum(query)));
+ break;
+ case RTOverAboveStrategyNumber:
+ retval = DatumGetBool(DirectFunctionCall2(box_overabove, PointerGetDatum(key), PointerGetDatum(query)));
+ break;
default:
retval = FALSE;
}
case RTContainedByStrategyNumber:
retval = DatumGetBool(DirectFunctionCall2(box_overlap, PointerGetDatum(key), PointerGetDatum(query)));
break;
+ case RTOverBelowStrategyNumber:
+ retval = !DatumGetBool(DirectFunctionCall2(box_above, PointerGetDatum(key), PointerGetDatum(query)));
+ break;
+ case RTBelowStrategyNumber:
+ retval = !DatumGetBool(DirectFunctionCall2(box_overabove, PointerGetDatum(key), PointerGetDatum(query)));
+ break;
+ case RTAboveStrategyNumber:
+ retval = !DatumGetBool(DirectFunctionCall2(box_overbelow, PointerGetDatum(key), PointerGetDatum(query)));
+ break;
+ case RTOverAboveStrategyNumber:
+ retval = !DatumGetBool(DirectFunctionCall2(box_below, PointerGetDatum(key), PointerGetDatum(query)));
+ break;
default:
retval = FALSE;
}
CREATE FUNCTION gbox_penalty(internal,internal,internal)
RETURNS internal
AS 'MODULE_PATHNAME'
-LANGUAGE 'C' with (isstrict);
+LANGUAGE 'C' STRICT;
CREATE FUNCTION gbox_picksplit(internal, internal)
RETURNS internal
OPERATOR 6 ~= ,
OPERATOR 7 ~ ,
OPERATOR 8 @ ,
+ OPERATOR 9 &<| ,
+ OPERATOR 10 <<| ,
+ OPERATOR 11 |>> ,
+ OPERATOR 12 |&> ,
FUNCTION 1 gbox_consistent (internal, box, int4),
FUNCTION 2 gbox_union (internal, internal),
FUNCTION 3 gbox_compress (internal),
OPERATOR 6 ~= RECHECK,
OPERATOR 7 ~ RECHECK,
OPERATOR 8 @ RECHECK,
+ OPERATOR 9 &<| RECHECK,
+ OPERATOR 10 <<| RECHECK,
+ OPERATOR 11 |>> RECHECK,
+ OPERATOR 12 |&> RECHECK,
FUNCTION 1 gpoly_consistent (internal, polygon, int4),
FUNCTION 2 gbox_union (internal, internal),
FUNCTION 3 gpoly_compress (internal),
<!--
-$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
-->
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">
<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>
<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>
-<!-- $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>
<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>
<!--
-$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">
</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">
</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>
<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>
<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>
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/rtree/rtstrat.c,v 1.26 2005/06/24 00:18:52 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/rtree/rtstrat.c,v 1.27 2005/06/24 20:53:30 tgl Exp $
*
*-------------------------------------------------------------------------
*/
RTOverLeftStrategyNumber, /* right */
RTContainsStrategyNumber, /* same */
RTContainsStrategyNumber, /* contains */
- RTOverlapStrategyNumber /* contained-by */
+ RTOverlapStrategyNumber, /* contained-by */
+ RTAboveStrategyNumber, /* overbelow */
+ RTOverAboveStrategyNumber, /* below */
+ RTOverBelowStrategyNumber, /* above */
+ RTBelowStrategyNumber /* overabove */
};
/*
true, /* right */
false, /* same */
false, /* contains */
- false /* contained-by */
+ false, /* contained-by */
+ true, /* overbelow */
+ true, /* below */
+ true, /* above */
+ true /* overabove */
};
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/geo_ops.c,v 1.88 2004/12/31 22:01:21 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/geo_ops.c,v 1.89 2005/06/24 20:53:31 tgl Exp $
*
*-------------------------------------------------------------------------
*/
FPle(box2->low.y, box1->high.y)));
}
-/* box_overleft - is the right edge of box1 to the left of
- * the right edge of box2?
- *
- * This is "less than or equal" for the end of a time range,
- * when time ranges are stored as rectangles.
+/* box_left - is box1 strictly left of box2?
*/
Datum
-box_overleft(PG_FUNCTION_ARGS)
+box_left(PG_FUNCTION_ARGS)
{
BOX *box1 = PG_GETARG_BOX_P(0);
BOX *box2 = PG_GETARG_BOX_P(1);
- PG_RETURN_BOOL(FPle(box1->high.x, box2->high.x));
+ PG_RETURN_BOOL(FPlt(box1->high.x, box2->low.x));
}
-/* box_left - is box1 strictly left of box2?
+/* box_overleft - is the right edge of box1 at or left of
+ * the right edge of box2?
+ *
+ * This is "less than or equal" for the end of a time range,
+ * when time ranges are stored as rectangles.
*/
Datum
-box_left(PG_FUNCTION_ARGS)
+box_overleft(PG_FUNCTION_ARGS)
{
BOX *box1 = PG_GETARG_BOX_P(0);
BOX *box2 = PG_GETARG_BOX_P(1);
- PG_RETURN_BOOL(FPlt(box1->high.x, box2->low.x));
+ PG_RETURN_BOOL(FPle(box1->high.x, box2->high.x));
}
/* box_right - is box1 strictly right of box2?
PG_RETURN_BOOL(FPgt(box1->low.x, box2->high.x));
}
-/* box_overright - is the left edge of box1 to the right of
+/* box_overright - is the left edge of box1 at or right of
* the left edge of box2?
*
* This is "greater than or equal" for time ranges, when time ranges
PG_RETURN_BOOL(FPge(box1->low.x, box2->low.x));
}
+/* box_below - is box1 strictly below box2?
+ */
+Datum
+box_below(PG_FUNCTION_ARGS)
+{
+ BOX *box1 = PG_GETARG_BOX_P(0);
+ BOX *box2 = PG_GETARG_BOX_P(1);
+
+ PG_RETURN_BOOL(FPlt(box1->high.y, box2->low.y));
+}
+
+/* box_overbelow - is the upper edge of box1 at or below
+ * the upper edge of box2?
+ */
+Datum
+box_overbelow(PG_FUNCTION_ARGS)
+{
+ BOX *box1 = PG_GETARG_BOX_P(0);
+ BOX *box2 = PG_GETARG_BOX_P(1);
+
+ PG_RETURN_BOOL(FPle(box1->high.y, box2->high.y));
+}
+
+/* box_above - is box1 strictly above box2?
+ */
+Datum
+box_above(PG_FUNCTION_ARGS)
+{
+ BOX *box1 = PG_GETARG_BOX_P(0);
+ BOX *box2 = PG_GETARG_BOX_P(1);
+
+ PG_RETURN_BOOL(FPgt(box1->low.y, box2->high.y));
+}
+
+/* box_overabove - is the lower edge of box1 at or above
+ * the lower edge of box2?
+ */
+Datum
+box_overabove(PG_FUNCTION_ARGS)
+{
+ BOX *box1 = PG_GETARG_BOX_P(0);
+ BOX *box2 = PG_GETARG_BOX_P(1);
+
+ PG_RETURN_BOOL(FPge(box1->low.y, box2->low.y));
+}
+
/* box_contained - is box1 contained by box2?
*/
Datum
/* box_positionop -
* is box1 entirely {above,below} box2?
+ *
+ * box_below_eq and box_above_eq are obsolete versions that (probably
+ * erroneously) accept the equal-boundaries case. Since these are not
+ * in sync with the box_left and box_right code, they are deprecated and
+ * not supported in the PG 8.1 rtree operator class extension.
*/
Datum
-box_below(PG_FUNCTION_ARGS)
+box_below_eq(PG_FUNCTION_ARGS)
{
BOX *box1 = PG_GETARG_BOX_P(0);
BOX *box2 = PG_GETARG_BOX_P(1);
}
Datum
-box_above(PG_FUNCTION_ARGS)
+box_above_eq(PG_FUNCTION_ARGS)
{
BOX *box1 = PG_GETARG_BOX_P(0);
BOX *box2 = PG_GETARG_BOX_P(1);
/*-------------------------------------------------------
* Is polygon A overlapping or left of polygon B? i.e. is
- * the left most point of A left of the right most point
+ * the right most point of A at or left of the right most point
* of B?
*-------------------------------------------------------*/
Datum
POLYGON *polyb = PG_GETARG_POLYGON_P(1);
bool result;
- result = polya->boundbox.low.x <= polyb->boundbox.high.x;
+ result = polya->boundbox.high.x <= polyb->boundbox.high.x;
/*
* Avoid leaking memory for toasted inputs ... needed for rtree
/*-------------------------------------------------------
* Is polygon A overlapping or right of polygon B? i.e. is
- * the right most point of A right of the left most point
+ * the left most point of A at or right of the left most point
* of B?
*-------------------------------------------------------*/
Datum
POLYGON *polyb = PG_GETARG_POLYGON_P(1);
bool result;
- result = polya->boundbox.high.x > polyb->boundbox.low.x;
+ result = polya->boundbox.low.x >= polyb->boundbox.low.x;
+
+ /*
+ * Avoid leaking memory for toasted inputs ... needed for rtree
+ * indexes
+ */
+ PG_FREE_IF_COPY(polya, 0);
+ PG_FREE_IF_COPY(polyb, 1);
+
+ PG_RETURN_BOOL(result);
+}
+
+/*-------------------------------------------------------
+ * Is polygon A strictly below polygon B? i.e. is
+ * the upper most point of A below the lower most point
+ * of B?
+ *-------------------------------------------------------*/
+Datum
+poly_below(PG_FUNCTION_ARGS)
+{
+ POLYGON *polya = PG_GETARG_POLYGON_P(0);
+ POLYGON *polyb = PG_GETARG_POLYGON_P(1);
+ bool result;
+
+ result = polya->boundbox.high.y < polyb->boundbox.low.y;
/*
* Avoid leaking memory for toasted inputs ... needed for rtree
PG_RETURN_BOOL(result);
}
+/*-------------------------------------------------------
+ * Is polygon A overlapping or below polygon B? i.e. is
+ * the upper most point of A at or below the upper most point
+ * of B?
+ *-------------------------------------------------------*/
+Datum
+poly_overbelow(PG_FUNCTION_ARGS)
+{
+ POLYGON *polya = PG_GETARG_POLYGON_P(0);
+ POLYGON *polyb = PG_GETARG_POLYGON_P(1);
+ bool result;
+
+ result = polya->boundbox.high.y <= polyb->boundbox.high.y;
+
+ /*
+ * Avoid leaking memory for toasted inputs ... needed for rtree
+ * indexes
+ */
+ PG_FREE_IF_COPY(polya, 0);
+ PG_FREE_IF_COPY(polyb, 1);
+
+ PG_RETURN_BOOL(result);
+}
+
+/*-------------------------------------------------------
+ * Is polygon A strictly above polygon B? i.e. is
+ * the lower most point of A above the upper most point
+ * of B?
+ *-------------------------------------------------------*/
+Datum
+poly_above(PG_FUNCTION_ARGS)
+{
+ POLYGON *polya = PG_GETARG_POLYGON_P(0);
+ POLYGON *polyb = PG_GETARG_POLYGON_P(1);
+ bool result;
+
+ result = polya->boundbox.low.y > polyb->boundbox.high.y;
+
+ /*
+ * Avoid leaking memory for toasted inputs ... needed for rtree
+ * indexes
+ */
+ PG_FREE_IF_COPY(polya, 0);
+ PG_FREE_IF_COPY(polyb, 1);
+
+ PG_RETURN_BOOL(result);
+}
+
+/*-------------------------------------------------------
+ * Is polygon A overlapping or above polygon B? i.e. is
+ * the lower most point of A at or above the lower most point
+ * of B?
+ *-------------------------------------------------------*/
+Datum
+poly_overabove(PG_FUNCTION_ARGS)
+{
+ POLYGON *polya = PG_GETARG_POLYGON_P(0);
+ POLYGON *polyb = PG_GETARG_POLYGON_P(1);
+ bool result;
+
+ result = polya->boundbox.low.y >= polyb->boundbox.low.y;
+
+ /*
+ * Avoid leaking memory for toasted inputs ... needed for rtree
+ * indexes
+ */
+ PG_FREE_IF_COPY(polya, 0);
+ PG_FREE_IF_COPY(polyb, 1);
+
+ PG_RETURN_BOOL(result);
+}
+
+
/*-------------------------------------------------------
* Is polygon A the same as polygon B? i.e. are all the
* points the same?
* Determine if polygon A overlaps polygon B by determining if
* their bounding boxes overlap.
*
- * XXX ought to do a more correct check?
+ * XXX ought to do a more correct check!
*-----------------------------------------------------------------*/
Datum
poly_overlap(PG_FUNCTION_ARGS)
/*-----------------------------------------------------------------
- * Determine if polygon A is contained by polygon B by determining
- * if A's bounding box is contained by B's bounding box.
+ * Determine if polygon A is contained by polygon B
*-----------------------------------------------------------------*/
Datum
poly_contained(PG_FUNCTION_ARGS)
Datum polya = PG_GETARG_DATUM(0);
Datum polyb = PG_GETARG_DATUM(1);
+ /* Just switch the arguments and pass it off to poly_contain */
PG_RETURN_DATUM(DirectFunctionCall2(poly_contain, polyb, polya));
}
circle1->radius + circle2->radius));
}
-/* circle_overleft - is the right edge of circle1 to the left of
+/* circle_overleft - is the right edge of circle1 at or left of
* the right edge of circle2?
*/
Datum
CIRCLE *circle1 = PG_GETARG_CIRCLE_P(0);
CIRCLE *circle2 = PG_GETARG_CIRCLE_P(1);
- PG_RETURN_BOOL(FPle((circle1->center.x + circle1->radius),
+ PG_RETURN_BOOL(FPlt((circle1->center.x + circle1->radius),
(circle2->center.x - circle2->radius)));
}
CIRCLE *circle1 = PG_GETARG_CIRCLE_P(0);
CIRCLE *circle2 = PG_GETARG_CIRCLE_P(1);
- PG_RETURN_BOOL(FPge((circle1->center.x - circle1->radius),
+ PG_RETURN_BOOL(FPgt((circle1->center.x - circle1->radius),
(circle2->center.x + circle2->radius)));
}
-/* circle_overright - is the left edge of circle1 to the right of
+/* circle_overright - is the left edge of circle1 at or right of
* the left edge of circle2?
*/
Datum
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/rtree.h,v 1.40 2005/06/24 00:18:52 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/access/rtree.h,v 1.41 2005/06/24 20:53:31 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "utils/rel.h"
/* see rtstrat.c for what all this is about */
-#define RTNStrategies 8
+#define RTNStrategies 12
#define RTLeftStrategyNumber 1
#define RTOverLeftStrategyNumber 2
#define RTOverlapStrategyNumber 3
#define RTSameStrategyNumber 6
#define RTContainsStrategyNumber 7
#define RTContainedByStrategyNumber 8
+#define RTOverBelowStrategyNumber 9
+#define RTBelowStrategyNumber 10
+#define RTAboveStrategyNumber 11
+#define RTOverAboveStrategyNumber 12
#define RTNProcs 3
#define RT_UNION_PROC 1
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.280 2005/06/21 04:02:33 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.281 2005/06/24 20:53:31 tgl Exp $
*
*-------------------------------------------------------------------------
*/
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 200506202
+#define CATALOG_VERSION_NO 200506241
#endif
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/pg_am.h,v 1.35 2005/06/20 10:29:37 teodor Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_am.h,v 1.36 2005/06/24 20:53:31 tgl Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
* ----------------
*/
-DATA(insert OID = 402 ( rtree 8 3 0 f f f f f rtinsert rtbeginscan rtgettuple rtgetmulti rtrescan rtendscan rtmarkpos rtrestrpos rtbuild rtbulkdelete - rtcostestimate ));
+DATA(insert OID = 402 ( rtree 12 3 0 f f f f f rtinsert rtbeginscan rtgettuple rtgetmulti rtrescan rtendscan rtmarkpos rtrestrpos rtbuild rtbulkdelete - rtcostestimate ));
DESCR("r-tree index access method");
DATA(insert OID = 403 ( btree 5 1 1 t t t t t btinsert btbeginscan btgettuple btgetmulti btrescan btendscan btmarkpos btrestrpos btbuild btbulkdelete btvacuumcleanup btcostestimate ));
DESCR("b-tree index access method");
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/pg_amop.h,v 1.63 2005/04/14 01:38:20 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_amop.h,v 1.64 2005/06/24 20:53:31 tgl Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
* rtree box_ops
*/
-DATA(insert ( 425 0 1 f 493 ));
-DATA(insert ( 425 0 2 f 494 ));
-DATA(insert ( 425 0 3 f 500 ));
-DATA(insert ( 425 0 4 f 495 ));
-DATA(insert ( 425 0 5 f 496 ));
-DATA(insert ( 425 0 6 f 499 ));
-DATA(insert ( 425 0 7 f 498 ));
-DATA(insert ( 425 0 8 f 497 ));
+DATA(insert ( 425 0 1 f 493 ));
+DATA(insert ( 425 0 2 f 494 ));
+DATA(insert ( 425 0 3 f 500 ));
+DATA(insert ( 425 0 4 f 495 ));
+DATA(insert ( 425 0 5 f 496 ));
+DATA(insert ( 425 0 6 f 499 ));
+DATA(insert ( 425 0 7 f 498 ));
+DATA(insert ( 425 0 8 f 497 ));
+DATA(insert ( 425 0 9 f 2571 ));
+DATA(insert ( 425 0 10 f 2570 ));
+DATA(insert ( 425 0 11 f 2573 ));
+DATA(insert ( 425 0 12 f 2572 ));
/*
* rtree poly_ops (supports polygons)
*/
-DATA(insert ( 1993 0 1 f 485 ));
-DATA(insert ( 1993 0 2 f 486 ));
-DATA(insert ( 1993 0 3 f 492 ));
-DATA(insert ( 1993 0 4 f 487 ));
-DATA(insert ( 1993 0 5 f 488 ));
-DATA(insert ( 1993 0 6 f 491 ));
-DATA(insert ( 1993 0 7 f 490 ));
-DATA(insert ( 1993 0 8 f 489 ));
+DATA(insert ( 1993 0 1 f 485 ));
+DATA(insert ( 1993 0 2 f 486 ));
+DATA(insert ( 1993 0 3 f 492 ));
+DATA(insert ( 1993 0 4 f 487 ));
+DATA(insert ( 1993 0 5 f 488 ));
+DATA(insert ( 1993 0 6 f 491 ));
+DATA(insert ( 1993 0 7 f 490 ));
+DATA(insert ( 1993 0 8 f 489 ));
+DATA(insert ( 1993 0 9 f 2575 ));
+DATA(insert ( 1993 0 10 f 2574 ));
+DATA(insert ( 1993 0 11 f 2577 ));
+DATA(insert ( 1993 0 12 f 2576 ));
/*
* btree int2_ops
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/pg_operator.h,v 1.133 2005/06/08 21:15:28 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_operator.h,v 1.134 2005/06/24 20:53:31 tgl Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
DATA(insert OID = 797 ( "#" PGNSP PGUID l f 0 602 23 0 0 0 0 0 0 path_npoints - - ));
DATA(insert OID = 798 ( "?#" PGNSP PGUID b f 602 602 16 0 0 0 0 0 0 path_inter - - ));
DATA(insert OID = 799 ( "@-@" PGNSP PGUID l f 0 602 701 0 0 0 0 0 0 path_length - - ));
-DATA(insert OID = 800 ( ">^" PGNSP PGUID b f 603 603 16 0 0 0 0 0 0 box_above positionsel positionjoinsel ));
-DATA(insert OID = 801 ( "<^" PGNSP PGUID b f 603 603 16 0 0 0 0 0 0 box_below positionsel positionjoinsel ));
+DATA(insert OID = 800 ( ">^" PGNSP PGUID b f 603 603 16 0 0 0 0 0 0 box_above_eq positionsel positionjoinsel ));
+DATA(insert OID = 801 ( "<^" PGNSP PGUID b f 603 603 16 0 0 0 0 0 0 box_below_eq positionsel positionjoinsel ));
DATA(insert OID = 802 ( "?#" PGNSP PGUID b f 603 603 16 0 0 0 0 0 0 box_overlap areasel areajoinsel ));
DATA(insert OID = 803 ( "#" PGNSP PGUID b f 603 603 603 0 0 0 0 0 0 box_intersect - - ));
DATA(insert OID = 804 ( "+" PGNSP PGUID b f 603 600 603 0 0 0 0 0 0 box_add - - ));
DATA(insert OID = 2554 ( "+" PGNSP PGUID b f 1186 1184 1184 1327 0 0 0 0 0 interval_pl_timestamptz - - ));
DATA(insert OID = 2555 ( "+" PGNSP PGUID b f 23 1082 1082 1100 0 0 0 0 0 integer_pl_date - - ));
+/* new operators for Y-direction rtree opclasses */
+DATA(insert OID = 2570 ( "<<|" PGNSP PGUID b f 603 603 16 0 0 0 0 0 0 box_below positionsel positionjoinsel ));
+DATA(insert OID = 2571 ( "&<|" PGNSP PGUID b f 603 603 16 0 0 0 0 0 0 box_overbelow positionsel positionjoinsel ));
+DATA(insert OID = 2572 ( "|&>" PGNSP PGUID b f 603 603 16 0 0 0 0 0 0 box_overabove positionsel positionjoinsel ));
+DATA(insert OID = 2573 ( "|>>" PGNSP PGUID b f 603 603 16 0 0 0 0 0 0 box_above positionsel positionjoinsel ));
+DATA(insert OID = 2574 ( "<<|" PGNSP PGUID b f 604 604 16 0 0 0 0 0 0 poly_below positionsel positionjoinsel ));
+DATA(insert OID = 2575 ( "&<|" PGNSP PGUID b f 604 604 16 0 0 0 0 0 0 poly_overbelow positionsel positionjoinsel ));
+DATA(insert OID = 2576 ( "|&>" PGNSP PGUID b f 604 604 16 0 0 0 0 0 0 poly_overabove positionsel positionjoinsel ));
+DATA(insert OID = 2577 ( "|>>" PGNSP PGUID b f 604 604 16 0 0 0 0 0 0 poly_above positionsel positionjoinsel ));
+
/*
* function prototypes
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.369 2005/06/20 10:29:37 teodor Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.370 2005/06/24 20:53:32 tgl Exp $
*
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
DATA(insert OID = 114 ( text PGNSP PGUID 12 f f t f i 1 25 "26" _null_ _null_ _null_ oid_text - _null_ ));
DESCR("convert oid to text");
-DATA(insert OID = 115 ( box_above PGNSP PGUID 12 f f t f i 2 16 "603 603" _null_ _null_ _null_ box_above - _null_ ));
-DESCR("is above");
-DATA(insert OID = 116 ( box_below PGNSP PGUID 12 f f t f i 2 16 "603 603" _null_ _null_ _null_ box_below - _null_ ));
-DESCR("is below");
+DATA(insert OID = 115 ( box_above_eq PGNSP PGUID 12 f f t f i 2 16 "603 603" _null_ _null_ _null_ box_above_eq - _null_ ));
+DESCR("is above (allows touching)");
+DATA(insert OID = 116 ( box_below_eq PGNSP PGUID 12 f f t f i 2 16 "603 603" _null_ _null_ _null_ box_below_eq - _null_ ));
+DESCR("is below (allows touching)");
DATA(insert OID = 117 ( point_in PGNSP PGUID 12 f f t f i 1 600 "2275" _null_ _null_ _null_ point_in - _null_ ));
DESCR("I/O");
DATA(insert OID = 2560 ( pg_postmaster_start_time PGNSP PGUID 12 f f t f s 0 1184 "" _null_ _null_ _null_ pgsql_postmaster_start_time - _null_ ));
DESCR("postmaster start time");
+/* new functions for Y-direction rtree opclasses */
+DATA(insert OID = 2562 ( box_below PGNSP PGUID 12 f f t f i 2 16 "603 603" _null_ _null_ _null_ box_below - _null_ ));
+DESCR("is below");
+DATA(insert OID = 2563 ( box_overbelow PGNSP PGUID 12 f f t f i 2 16 "603 603" _null_ _null_ _null_ box_overbelow - _null_ ));
+DESCR("overlaps or is below");
+DATA(insert OID = 2564 ( box_overabove PGNSP PGUID 12 f f t f i 2 16 "603 603" _null_ _null_ _null_ box_overabove - _null_ ));
+DESCR("overlaps or is above");
+DATA(insert OID = 2565 ( box_above PGNSP PGUID 12 f f t f i 2 16 "603 603" _null_ _null_ _null_ box_above - _null_ ));
+DESCR("is above");
+DATA(insert OID = 2566 ( poly_below PGNSP PGUID 12 f f t f i 2 16 "604 604" _null_ _null_ _null_ poly_below - _null_ ));
+DESCR("is below");
+DATA(insert OID = 2567 ( poly_overbelow PGNSP PGUID 12 f f t f i 2 16 "604 604" _null_ _null_ _null_ poly_overbelow - _null_ ));
+DESCR("overlaps or is below");
+DATA(insert OID = 2568 ( poly_overabove PGNSP PGUID 12 f f t f i 2 16 "604 604" _null_ _null_ _null_ poly_overabove - _null_ ));
+DESCR("overlaps or is above");
+DATA(insert OID = 2569 ( poly_above PGNSP PGUID 12 f f t f i 2 16 "604 604" _null_ _null_ _null_ poly_above - _null_ ));
+DESCR("is above");
+
/*
* Symbolic values for provolatile column: these indicate whether the result
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/geo_decls.h,v 1.46 2004/12/31 22:03:46 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/utils/geo_decls.h,v 1.47 2005/06/24 20:53:33 tgl Exp $
*
* NOTE
* These routines do *not* use the float types from adt/.
extern Datum box_send(PG_FUNCTION_ARGS);
extern Datum box_same(PG_FUNCTION_ARGS);
extern Datum box_overlap(PG_FUNCTION_ARGS);
-extern Datum box_overleft(PG_FUNCTION_ARGS);
extern Datum box_left(PG_FUNCTION_ARGS);
+extern Datum box_overleft(PG_FUNCTION_ARGS);
extern Datum box_right(PG_FUNCTION_ARGS);
extern Datum box_overright(PG_FUNCTION_ARGS);
-extern Datum box_contained(PG_FUNCTION_ARGS);
-extern Datum box_contain(PG_FUNCTION_ARGS);
extern Datum box_below(PG_FUNCTION_ARGS);
+extern Datum box_overbelow(PG_FUNCTION_ARGS);
extern Datum box_above(PG_FUNCTION_ARGS);
+extern Datum box_overabove(PG_FUNCTION_ARGS);
+extern Datum box_contained(PG_FUNCTION_ARGS);
+extern Datum box_contain(PG_FUNCTION_ARGS);
+extern Datum box_below_eq(PG_FUNCTION_ARGS);
+extern Datum box_above_eq(PG_FUNCTION_ARGS);
extern Datum box_lt(PG_FUNCTION_ARGS);
extern Datum box_gt(PG_FUNCTION_ARGS);
extern Datum box_eq(PG_FUNCTION_ARGS);
extern Datum poly_overleft(PG_FUNCTION_ARGS);
extern Datum poly_right(PG_FUNCTION_ARGS);
extern Datum poly_overright(PG_FUNCTION_ARGS);
+extern Datum poly_below(PG_FUNCTION_ARGS);
+extern Datum poly_overbelow(PG_FUNCTION_ARGS);
+extern Datum poly_above(PG_FUNCTION_ARGS);
+extern Datum poly_overabove(PG_FUNCTION_ARGS);
extern Datum poly_same(PG_FUNCTION_ARGS);
extern Datum poly_overlap(PG_FUNCTION_ARGS);
extern Datum poly_contain(PG_FUNCTION_ARGS);
402 | 6 | ~=
402 | 7 | ~
402 | 8 | @
+ 402 | 9 | &<|
+ 402 | 10 | <<|
+ 402 | 11 | |>>
+ 402 | 12 | |&>
403 | 1 | <
403 | 1 | ~<~
403 | 2 | <=
403 | 5 | ~>~
405 | 1 | =
405 | 1 | ~=~
-(20 rows)
+(24 rows)
-- Check that all operators linked to by opclass entries have selectivity
-- estimators. This is not absolutely required, but it seems a reasonable
WHERE p.f1 &> '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
two | f1
-----+---------------------
- | ((2,0),(2,4),(0,0))
| ((3,1),(3,3),(1,0))
-(2 rows)
+(1 row)
-- left of
SELECT '' AS one, p.*
(1 row)
-- right overlap
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' &> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS true;
- true
-------
- t
+SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' &> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
+ false
+-------
+ f
(1 row)
-- right of
SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' << polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS true;
-- right overlap
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' &> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS true;
+SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' &> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
-- right of
SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' >> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;