Extend r-tree operator classes to handle Y-direction tests equivalent
Tom Lane <tgl@sss.pgh.pa.us>
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.
Files
| Path | Change | +/− |
|---|---|---|
| contrib/rtree_gist/rtree_gist.c | modified | +32 −8 |
| contrib/rtree_gist/rtree_gist.sql.in | modified | +9 −1 |
| doc/src/sgml/func.sgml | modified | +40 −9 |
| doc/src/sgml/indices.sgml | modified | +6 −1 |
| doc/src/sgml/xindex.sgml | modified | +29 −9 |
| src/backend/access/rtree/rtstrat.c | modified | +11 −3 |
| src/backend/utils/adt/geo_ops.c | modified | +173 −25 |
| src/include/access/rtree.h | modified | +6 −2 |
| src/include/catalog/catversion.h | modified | +2 −2 |
| src/include/catalog/pg_am.h | modified | +2 −2 |
| src/include/catalog/pg_amop.h | modified | +25 −17 |
| src/include/catalog/pg_operator.h | modified | +13 −3 |
| src/include/catalog/pg_proc.h | modified | +23 −5 |
| src/include/utils/geo_decls.h | modified | +12 −4 |
| src/test/regress/expected/opr_sanity.out | modified | +5 −1 |
| src/test/regress/expected/polygon.out | modified | +5 −6 |
| src/test/regress/sql/polygon.sql | modified | +1 −1 |