From 0cc99327888840f2bf572303b68438e4caf62de9 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 23 Nov 2020 11:38:37 -0500 Subject: [PATCH] Rename the "point is strictly above/below point" comparison operators. Historically these were called >^ and <^, but that is inconsistent with the similar box, polygon, and circle operators, which are named |>> and <<| respectively. Worse, the >^ and <^ names are used for *not* strict above/below tests for the box type. Hence, invent new operators following the more common naming. The old operators remain available for now, and are still accepted by the relevant index opclasses too. But there's a deprecation notice, so maybe we can get rid of them someday. Emre Hasegeli, reviewed by Pavel Borisov Discussion: https://postgr.es/m/24348.1587444160@sss.pgh.pa.us --- doc/src/sgml/func.sgml | 46 ++++------- doc/src/sgml/gist.sgml | 4 +- doc/src/sgml/spgist.sgml | 14 ++-- src/backend/access/gist/gistproc.c | 12 ++- src/backend/access/spgist/spgkdtreeproc.c | 2 + src/backend/access/spgist/spgquadtreeproc.c | 4 + src/include/access/stratnum.h | 4 +- src/include/catalog/catversion.h | 2 +- src/include/catalog/pg_amop.dat | 30 ++++++-- src/include/catalog/pg_operator.dat | 13 +++- src/test/regress/expected/create_index.out | 16 ++-- .../regress/expected/create_index_spgist.out | 76 +++++++++---------- src/test/regress/expected/opr_sanity.out | 8 +- src/test/regress/expected/point.out | 6 +- src/test/regress/sql/create_index.sql | 12 +-- src/test/regress/sql/create_index_spgist.sql | 36 ++++----- src/test/regress/sql/point.sql | 6 +- 17 files changed, 159 insertions(+), 132 deletions(-) diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 7d06b979eb..507bc1a668 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -10609,7 +10609,7 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple Is first object strictly below second? - Available for box, polygon, + Available for point, box, polygon, circle. @@ -10625,7 +10625,7 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple Is first object strictly above second? - Available for box, polygon, + Available for point, box, polygon, circle. @@ -10680,21 +10680,6 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple - - - point <^ point - boolean - - - Is first object strictly below second? - (This operator is misnamed; it should be <<|.) - - - point '(1,0)' <^ point '(1,1)' - t - - - box >^ box @@ -10709,21 +10694,6 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple - - - point >^ point - boolean - - - Is first object strictly above second? - (This operator is misnamed; it should be |>>.) - - - point '(1,1)' >^ point '(1,0)' - t - - - geometric_type ?# geometric_type @@ -10877,6 +10847,18 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple + + + Before PostgreSQL 14, the point + is strictly below/above comparison operators point + <<| point and point + |>> point were respectively + called <^ and >^. These + names are still available, but are deprecated and will eventually be + removed. + + + Geometric Functions diff --git a/doc/src/sgml/gist.sgml b/doc/src/sgml/gist.sgml index 1bf5f09659..d1b6cc9a01 100644 --- a/doc/src/sgml/gist.sgml +++ b/doc/src/sgml/gist.sgml @@ -118,12 +118,12 @@ point_ops - >^ (point,point) + |>> (point,point) <-> (point,point) << (point,point) >> (point,point) - <^ (point,point) + <<| (point,point) ~= (point,point) <@ (point,box) <@ (point,polygon) diff --git a/doc/src/sgml/spgist.sgml b/doc/src/sgml/spgist.sgml index 68d09951d9..ea88ae45e5 100644 --- a/doc/src/sgml/spgist.sgml +++ b/doc/src/sgml/spgist.sgml @@ -76,7 +76,7 @@ box_ops << (box,box) - <-> (box,point) + <-> (box,point) &< (box,box) &> (box,box) @@ -92,12 +92,12 @@ kd_point_ops - >^ (point,point) + |>> (point,point) <-> (point,point) << (point,point) >> (point,point) - <^ (point,point) + <<| (point,point) ~= (point,point) <@ (point,box) @@ -132,16 +132,16 @@ <<| (polygon,polygon) &<| (polygon,polygon) |>> (polygon,polygon) - |&> (polygon,polygon) + |&> (polygon,polygon) quad_point_ops - >^ (point,point) + |>> (point,point) <-> (point,point) << (point,point) >> (point,point) - <^ (point,point) + <<| (point,point) ~= (point,point) <@ (point,box) @@ -159,7 +159,7 @@ &< (anyrange,anyrange) &> (anyrange,anyrange) -|- (anyrange,anyrange) - + text_ops = (text,text) diff --git a/src/backend/access/gist/gistproc.c b/src/backend/access/gist/gistproc.c index b03c4b55a0..784807c636 100644 --- a/src/backend/access/gist/gistproc.c +++ b/src/backend/access/gist/gistproc.c @@ -1341,8 +1341,18 @@ gist_point_consistent(PG_FUNCTION_ARGS) StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); bool *recheck = (bool *) PG_GETARG_POINTER(4); bool result; - StrategyNumber strategyGroup = strategy / GeoStrategyNumberOffset; + StrategyNumber strategyGroup; + /* + * We have to remap these strategy numbers to get this klugy + * classification logic to work. + */ + if (strategy == RTOldBelowStrategyNumber) + strategy = RTBelowStrategyNumber; + else if (strategy == RTOldAboveStrategyNumber) + strategy = RTAboveStrategyNumber; + + strategyGroup = strategy / GeoStrategyNumberOffset; switch (strategyGroup) { case PointStrategyNumberGroup: diff --git a/src/backend/access/spgist/spgkdtreeproc.c b/src/backend/access/spgist/spgkdtreeproc.c index bee30153f7..6581238cef 100644 --- a/src/backend/access/spgist/spgkdtreeproc.c +++ b/src/backend/access/spgist/spgkdtreeproc.c @@ -209,10 +209,12 @@ spg_kd_inner_consistent(PG_FUNCTION_ARGS) } break; case RTBelowStrategyNumber: + case RTOldBelowStrategyNumber: if ((in->level % 2) == 0 && FPlt(query->y, coord)) which &= (1 << 1); break; case RTAboveStrategyNumber: + case RTOldAboveStrategyNumber: if ((in->level % 2) == 0 && FPgt(query->y, coord)) which &= (1 << 2); break; diff --git a/src/backend/access/spgist/spgquadtreeproc.c b/src/backend/access/spgist/spgquadtreeproc.c index b4451cc1ae..249b3828fe 100644 --- a/src/backend/access/spgist/spgquadtreeproc.c +++ b/src/backend/access/spgist/spgquadtreeproc.c @@ -316,10 +316,12 @@ spg_quad_inner_consistent(PG_FUNCTION_ARGS) which &= (1 << getQuadrant(centroid, query)); break; case RTBelowStrategyNumber: + case RTOldBelowStrategyNumber: if (SPTEST(point_above, centroid, query)) which &= (1 << 2) | (1 << 3); break; case RTAboveStrategyNumber: + case RTOldAboveStrategyNumber: if (SPTEST(point_below, centroid, query)) which &= (1 << 1) | (1 << 4); break; @@ -434,9 +436,11 @@ spg_quad_leaf_consistent(PG_FUNCTION_ARGS) res = SPTEST(point_eq, datum, query); break; case RTBelowStrategyNumber: + case RTOldBelowStrategyNumber: res = SPTEST(point_below, datum, query); break; case RTAboveStrategyNumber: + case RTOldAboveStrategyNumber: res = SPTEST(point_above, datum, query); break; case RTContainedByStrategyNumber: diff --git a/src/include/access/stratnum.h b/src/include/access/stratnum.h index d280f7e4fc..415e1f7e88 100644 --- a/src/include/access/stratnum.h +++ b/src/include/access/stratnum.h @@ -76,8 +76,10 @@ typedef uint16 StrategyNumber; #define RTSuperStrategyNumber 26 /* for inet << */ #define RTSuperEqualStrategyNumber 27 /* for inet >>= */ #define RTPrefixStrategyNumber 28 /* for text ^@ */ +#define RTOldBelowStrategyNumber 29 /* for old spelling of <<| */ +#define RTOldAboveStrategyNumber 30 /* for old spelling of |>> */ -#define RTMaxStrategyNumber 28 +#define RTMaxStrategyNumber 30 #endif /* STRATNUM_H */ diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index c6da0df868..1276ff8bda 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 202011191 +#define CATALOG_VERSION_NO 202011231 #endif diff --git a/src/include/catalog/pg_amop.dat b/src/include/catalog/pg_amop.dat index c7fee9f3ab..2c899f19d9 100644 --- a/src/include/catalog/pg_amop.dat +++ b/src/include/catalog/pg_amop.dat @@ -1111,7 +1111,10 @@ # gist point_ops { amopfamily => 'gist/point_ops', amoplefttype => 'point', - amoprighttype => 'point', amopstrategy => '11', amopopr => '>^(point,point)', + amoprighttype => 'point', amopstrategy => '11', amopopr => '|>>(point,point)', + amopmethod => 'gist' }, +{ amopfamily => 'gist/point_ops', amoplefttype => 'point', + amoprighttype => 'point', amopstrategy => '30', amopopr => '>^(point,point)', amopmethod => 'gist' }, { amopfamily => 'gist/point_ops', amoplefttype => 'point', amoprighttype => 'point', amopstrategy => '1', amopopr => '<<(point,point)', @@ -1120,7 +1123,10 @@ amoprighttype => 'point', amopstrategy => '5', amopopr => '>>(point,point)', amopmethod => 'gist' }, { amopfamily => 'gist/point_ops', amoplefttype => 'point', - amoprighttype => 'point', amopstrategy => '10', amopopr => '<^(point,point)', + amoprighttype => 'point', amopstrategy => '10', amopopr => '<<|(point,point)', + amopmethod => 'gist' }, +{ amopfamily => 'gist/point_ops', amoplefttype => 'point', + amoprighttype => 'point', amopstrategy => '29', amopopr => '<^(point,point)', amopmethod => 'gist' }, { amopfamily => 'gist/point_ops', amoplefttype => 'point', amoprighttype => 'point', amopstrategy => '6', amopopr => '~=(point,point)', @@ -1370,7 +1376,10 @@ # SP-GiST quad_point_ops { amopfamily => 'spgist/quad_point_ops', amoplefttype => 'point', - amoprighttype => 'point', amopstrategy => '11', amopopr => '>^(point,point)', + amoprighttype => 'point', amopstrategy => '11', amopopr => '|>>(point,point)', + amopmethod => 'spgist' }, +{ amopfamily => 'spgist/quad_point_ops', amoplefttype => 'point', + amoprighttype => 'point', amopstrategy => '30', amopopr => '>^(point,point)', amopmethod => 'spgist' }, { amopfamily => 'spgist/quad_point_ops', amoplefttype => 'point', amoprighttype => 'point', amopstrategy => '1', amopopr => '<<(point,point)', @@ -1379,7 +1388,10 @@ amoprighttype => 'point', amopstrategy => '5', amopopr => '>>(point,point)', amopmethod => 'spgist' }, { amopfamily => 'spgist/quad_point_ops', amoplefttype => 'point', - amoprighttype => 'point', amopstrategy => '10', amopopr => '<^(point,point)', + amoprighttype => 'point', amopstrategy => '10', amopopr => '<<|(point,point)', + amopmethod => 'spgist' }, +{ amopfamily => 'spgist/quad_point_ops', amoplefttype => 'point', + amoprighttype => 'point', amopstrategy => '29', amopopr => '<^(point,point)', amopmethod => 'spgist' }, { amopfamily => 'spgist/quad_point_ops', amoplefttype => 'point', amoprighttype => 'point', amopstrategy => '6', amopopr => '~=(point,point)', @@ -1394,7 +1406,10 @@ # SP-GiST kd_point_ops { amopfamily => 'spgist/kd_point_ops', amoplefttype => 'point', - amoprighttype => 'point', amopstrategy => '11', amopopr => '>^(point,point)', + amoprighttype => 'point', amopstrategy => '11', amopopr => '|>>(point,point)', + amopmethod => 'spgist' }, +{ amopfamily => 'spgist/kd_point_ops', amoplefttype => 'point', + amoprighttype => 'point', amopstrategy => '30', amopopr => '>^(point,point)', amopmethod => 'spgist' }, { amopfamily => 'spgist/kd_point_ops', amoplefttype => 'point', amoprighttype => 'point', amopstrategy => '1', amopopr => '<<(point,point)', @@ -1403,7 +1418,10 @@ amoprighttype => 'point', amopstrategy => '5', amopopr => '>>(point,point)', amopmethod => 'spgist' }, { amopfamily => 'spgist/kd_point_ops', amoplefttype => 'point', - amoprighttype => 'point', amopstrategy => '10', amopopr => '<^(point,point)', + amoprighttype => 'point', amopstrategy => '10', amopopr => '<<|(point,point)', + amopmethod => 'spgist' }, +{ amopfamily => 'spgist/kd_point_ops', amoplefttype => 'point', + amoprighttype => 'point', amopstrategy => '29', amopopr => '<^(point,point)', amopmethod => 'spgist' }, { amopfamily => 'spgist/kd_point_ops', amoplefttype => 'point', amoprighttype => 'point', amopstrategy => '6', amopopr => '~=(point,point)', diff --git a/src/include/catalog/pg_operator.dat b/src/include/catalog/pg_operator.dat index b3f5645977..7ae19235ee 100644 --- a/src/include/catalog/pg_operator.dat +++ b/src/include/catalog/pg_operator.dat @@ -395,7 +395,7 @@ oprname => '<=', oprleft => 'box', oprright => 'box', oprresult => 'bool', oprcom => '>=(box,box)', oprnegate => '>(box,box)', oprcode => 'box_le', oprrest => 'areasel', oprjoin => 'areajoinsel' }, -{ oid => '506', descr => 'is above', +{ oid => '506', descr => 'deprecated, use |>> instead', oprname => '>^', oprleft => 'point', oprright => 'point', oprresult => 'bool', oprcode => 'point_above', oprrest => 'positionsel', oprjoin => 'positionjoinsel' }, @@ -407,7 +407,7 @@ oprname => '>>', oprleft => 'point', oprright => 'point', oprresult => 'bool', oprcode => 'point_right', oprrest => 'positionsel', oprjoin => 'positionjoinsel' }, -{ oid => '509', descr => 'is below', +{ oid => '509', descr => 'deprecated, use <<| instead', oprname => '<^', oprleft => 'point', oprright => 'point', oprresult => 'bool', oprcode => 'point_below', oprrest => 'positionsel', oprjoin => 'positionjoinsel' }, @@ -1878,6 +1878,15 @@ oprname => '#', oprleft => 'line', oprright => 'line', oprresult => 'point', oprcom => '#(line,line)', oprcode => 'line_interpt' }, +{ oid => '4161', descr => 'is above', + oprname => '|>>', oprleft => 'point', oprright => 'point', + oprresult => 'bool', oprcode => 'point_above', oprrest => 'positionsel', + oprjoin => 'positionjoinsel' }, +{ oid => '4162', descr => 'is below', + oprname => '<<|', oprleft => 'point', oprright => 'point', + oprresult => 'bool', oprcode => 'point_below', oprrest => 'positionsel', + oprjoin => 'positionjoinsel' }, + # MACADDR type { oid => '1220', descr => 'equal', oprname => '=', oprcanmerge => 't', oprcanhash => 't', oprleft => 'macaddr', diff --git a/src/test/regress/expected/create_index.out b/src/test/regress/expected/create_index.out index 76679bae8d..18bb92b810 100644 --- a/src/test/regress/expected/create_index.out +++ b/src/test/regress/expected/create_index.out @@ -160,13 +160,13 @@ SELECT count(*) FROM point_tbl p WHERE p.f1 >> '(0.0, 0.0)'; 4 (1 row) -SELECT count(*) FROM point_tbl p WHERE p.f1 <^ '(0.0, 0.0)'; +SELECT count(*) FROM point_tbl p WHERE p.f1 <<| '(0.0, 0.0)'; count ------- 1 (1 row) -SELECT count(*) FROM point_tbl p WHERE p.f1 >^ '(0.0, 0.0)'; +SELECT count(*) FROM point_tbl p WHERE p.f1 |>> '(0.0, 0.0)'; count ------- 5 @@ -470,30 +470,30 @@ SELECT count(*) FROM point_tbl p WHERE p.f1 >> '(0.0, 0.0)'; (1 row) EXPLAIN (COSTS OFF) -SELECT count(*) FROM point_tbl p WHERE p.f1 <^ '(0.0, 0.0)'; +SELECT count(*) FROM point_tbl p WHERE p.f1 <<| '(0.0, 0.0)'; QUERY PLAN ------------------------------------------------------ Aggregate -> Index Only Scan using gpointind on point_tbl p - Index Cond: (f1 <^ '(0,0)'::point) + Index Cond: (f1 <<| '(0,0)'::point) (3 rows) -SELECT count(*) FROM point_tbl p WHERE p.f1 <^ '(0.0, 0.0)'; +SELECT count(*) FROM point_tbl p WHERE p.f1 <<| '(0.0, 0.0)'; count ------- 1 (1 row) EXPLAIN (COSTS OFF) -SELECT count(*) FROM point_tbl p WHERE p.f1 >^ '(0.0, 0.0)'; +SELECT count(*) FROM point_tbl p WHERE p.f1 |>> '(0.0, 0.0)'; QUERY PLAN ------------------------------------------------------ Aggregate -> Index Only Scan using gpointind on point_tbl p - Index Cond: (f1 >^ '(0,0)'::point) + Index Cond: (f1 |>> '(0,0)'::point) (3 rows) -SELECT count(*) FROM point_tbl p WHERE p.f1 >^ '(0.0, 0.0)'; +SELECT count(*) FROM point_tbl p WHERE p.f1 |>> '(0.0, 0.0)'; count ------- 5 diff --git a/src/test/regress/expected/create_index_spgist.out b/src/test/regress/expected/create_index_spgist.out index 1dd110dfc5..afe38e16a2 100644 --- a/src/test/regress/expected/create_index_spgist.out +++ b/src/test/regress/expected/create_index_spgist.out @@ -62,13 +62,13 @@ SELECT count(*) FROM quad_point_tbl WHERE p >> '(5000, 4000)'; 4999 (1 row) -SELECT count(*) FROM quad_point_tbl WHERE p <^ '(5000, 4000)'; +SELECT count(*) FROM quad_point_tbl WHERE p <<| '(5000, 4000)'; count ------- 5000 (1 row) -SELECT count(*) FROM quad_point_tbl WHERE p >^ '(5000, 4000)'; +SELECT count(*) FROM quad_point_tbl WHERE p |>> '(5000, 4000)'; count ------- 5999 @@ -282,30 +282,30 @@ SELECT count(*) FROM quad_point_tbl WHERE p >> '(5000, 4000)'; (1 row) EXPLAIN (COSTS OFF) -SELECT count(*) FROM quad_point_tbl WHERE p <^ '(5000, 4000)'; +SELECT count(*) FROM quad_point_tbl WHERE p <<| '(5000, 4000)'; QUERY PLAN ----------------------------------------------------------- Aggregate -> Index Only Scan using sp_quad_ind on quad_point_tbl - Index Cond: (p <^ '(5000,4000)'::point) + Index Cond: (p <<| '(5000,4000)'::point) (3 rows) -SELECT count(*) FROM quad_point_tbl WHERE p <^ '(5000, 4000)'; +SELECT count(*) FROM quad_point_tbl WHERE p <<| '(5000, 4000)'; count ------- 5000 (1 row) EXPLAIN (COSTS OFF) -SELECT count(*) FROM quad_point_tbl WHERE p >^ '(5000, 4000)'; +SELECT count(*) FROM quad_point_tbl WHERE p |>> '(5000, 4000)'; QUERY PLAN ----------------------------------------------------------- Aggregate -> Index Only Scan using sp_quad_ind on quad_point_tbl - Index Cond: (p >^ '(5000,4000)'::point) + Index Cond: (p |>> '(5000,4000)'::point) (3 rows) -SELECT count(*) FROM quad_point_tbl WHERE p >^ '(5000, 4000)'; +SELECT count(*) FROM quad_point_tbl WHERE p |>> '(5000, 4000)'; count ------- 5999 @@ -449,30 +449,30 @@ SELECT count(*) FROM kd_point_tbl WHERE p >> '(5000, 4000)'; (1 row) EXPLAIN (COSTS OFF) -SELECT count(*) FROM kd_point_tbl WHERE p <^ '(5000, 4000)'; +SELECT count(*) FROM kd_point_tbl WHERE p <<| '(5000, 4000)'; QUERY PLAN ------------------------------------------------------- Aggregate -> Index Only Scan using sp_kd_ind on kd_point_tbl - Index Cond: (p <^ '(5000,4000)'::point) + Index Cond: (p <<| '(5000,4000)'::point) (3 rows) -SELECT count(*) FROM kd_point_tbl WHERE p <^ '(5000, 4000)'; +SELECT count(*) FROM kd_point_tbl WHERE p <<| '(5000, 4000)'; count ------- 5000 (1 row) EXPLAIN (COSTS OFF) -SELECT count(*) FROM kd_point_tbl WHERE p >^ '(5000, 4000)'; +SELECT count(*) FROM kd_point_tbl WHERE p |>> '(5000, 4000)'; QUERY PLAN ------------------------------------------------------- Aggregate -> Index Only Scan using sp_kd_ind on kd_point_tbl - Index Cond: (p >^ '(5000,4000)'::point) + Index Cond: (p |>> '(5000,4000)'::point) (3 rows) -SELECT count(*) FROM kd_point_tbl WHERE p >^ '(5000, 4000)'; +SELECT count(*) FROM kd_point_tbl WHERE p |>> '(5000, 4000)'; count ------- 5999 @@ -897,34 +897,34 @@ SELECT count(*) FROM quad_point_tbl WHERE p >> '(5000, 4000)'; (1 row) EXPLAIN (COSTS OFF) -SELECT count(*) FROM quad_point_tbl WHERE p <^ '(5000, 4000)'; - QUERY PLAN -------------------------------------------------------- +SELECT count(*) FROM quad_point_tbl WHERE p <<| '(5000, 4000)'; + QUERY PLAN +-------------------------------------------------------- Aggregate -> Bitmap Heap Scan on quad_point_tbl - Recheck Cond: (p <^ '(5000,4000)'::point) + Recheck Cond: (p <<| '(5000,4000)'::point) -> Bitmap Index Scan on sp_quad_ind - Index Cond: (p <^ '(5000,4000)'::point) + Index Cond: (p <<| '(5000,4000)'::point) (5 rows) -SELECT count(*) FROM quad_point_tbl WHERE p <^ '(5000, 4000)'; +SELECT count(*) FROM quad_point_tbl WHERE p <<| '(5000, 4000)'; count ------- 5000 (1 row) EXPLAIN (COSTS OFF) -SELECT count(*) FROM quad_point_tbl WHERE p >^ '(5000, 4000)'; - QUERY PLAN -------------------------------------------------------- +SELECT count(*) FROM quad_point_tbl WHERE p |>> '(5000, 4000)'; + QUERY PLAN +-------------------------------------------------------- Aggregate -> Bitmap Heap Scan on quad_point_tbl - Recheck Cond: (p >^ '(5000,4000)'::point) + Recheck Cond: (p |>> '(5000,4000)'::point) -> Bitmap Index Scan on sp_quad_ind - Index Cond: (p >^ '(5000,4000)'::point) + Index Cond: (p |>> '(5000,4000)'::point) (5 rows) -SELECT count(*) FROM quad_point_tbl WHERE p >^ '(5000, 4000)'; +SELECT count(*) FROM quad_point_tbl WHERE p |>> '(5000, 4000)'; count ------- 5999 @@ -1016,34 +1016,34 @@ SELECT count(*) FROM kd_point_tbl WHERE p >> '(5000, 4000)'; (1 row) EXPLAIN (COSTS OFF) -SELECT count(*) FROM kd_point_tbl WHERE p <^ '(5000, 4000)'; - QUERY PLAN -------------------------------------------------------- +SELECT count(*) FROM kd_point_tbl WHERE p <<| '(5000, 4000)'; + QUERY PLAN +-------------------------------------------------------- Aggregate -> Bitmap Heap Scan on kd_point_tbl - Recheck Cond: (p <^ '(5000,4000)'::point) + Recheck Cond: (p <<| '(5000,4000)'::point) -> Bitmap Index Scan on sp_kd_ind - Index Cond: (p <^ '(5000,4000)'::point) + Index Cond: (p <<| '(5000,4000)'::point) (5 rows) -SELECT count(*) FROM kd_point_tbl WHERE p <^ '(5000, 4000)'; +SELECT count(*) FROM kd_point_tbl WHERE p <<| '(5000, 4000)'; count ------- 5000 (1 row) EXPLAIN (COSTS OFF) -SELECT count(*) FROM kd_point_tbl WHERE p >^ '(5000, 4000)'; - QUERY PLAN -------------------------------------------------------- +SELECT count(*) FROM kd_point_tbl WHERE p |>> '(5000, 4000)'; + QUERY PLAN +-------------------------------------------------------- Aggregate -> Bitmap Heap Scan on kd_point_tbl - Recheck Cond: (p >^ '(5000,4000)'::point) + Recheck Cond: (p |>> '(5000,4000)'::point) -> Bitmap Index Scan on sp_kd_ind - Index Cond: (p >^ '(5000,4000)'::point) + Index Cond: (p |>> '(5000,4000)'::point) (5 rows) -SELECT count(*) FROM kd_point_tbl WHERE p >^ '(5000, 4000)'; +SELECT count(*) FROM kd_point_tbl WHERE p |>> '(5000, 4000)'; count ------- 5999 diff --git a/src/test/regress/expected/opr_sanity.out b/src/test/regress/expected/opr_sanity.out index 7ed29b4961..3b39137400 100644 --- a/src/test/regress/expected/opr_sanity.out +++ b/src/test/regress/expected/opr_sanity.out @@ -1985,8 +1985,6 @@ ORDER BY 1, 2, 3; 783 | 8 | <@ 783 | 9 | &<| 783 | 10 | <<| - 783 | 10 | <^ - 783 | 11 | >^ 783 | 11 | |>> 783 | 12 | |&> 783 | 15 | <-> @@ -2002,6 +2000,8 @@ ORDER BY 1, 2, 3; 783 | 26 | >> 783 | 27 | >>= 783 | 28 | <@ + 783 | 29 | <^ + 783 | 30 | >^ 783 | 48 | <@ 783 | 68 | <@ 2742 | 1 | && @@ -2060,9 +2060,7 @@ ORDER BY 1, 2, 3; 4000 | 8 | <@ 4000 | 9 | &<| 4000 | 10 | <<| - 4000 | 10 | <^ 4000 | 11 | < - 4000 | 11 | >^ 4000 | 11 | |>> 4000 | 12 | <= 4000 | 12 | |&> @@ -2081,6 +2079,8 @@ ORDER BY 1, 2, 3; 4000 | 26 | >> 4000 | 27 | >>= 4000 | 28 | ^@ + 4000 | 29 | <^ + 4000 | 30 | >^ (123 rows) -- Check that all opclass search operators have selectivity estimators. diff --git a/src/test/regress/expected/point.out b/src/test/regress/expected/point.out index 77e250fc3e..1fa9d7ce2c 100644 --- a/src/test/regress/expected/point.out +++ b/src/test/regress/expected/point.out @@ -69,14 +69,14 @@ SELECT '' AS three, p.* FROM POINT_TBL p WHERE '(0.0,0.0)' >> p.f1; (3 rows) -- above -SELECT '' AS one, p.* FROM POINT_TBL p WHERE '(0.0,0.0)' >^ p.f1; +SELECT '' AS one, p.* FROM POINT_TBL p WHERE '(0.0,0.0)' |>> p.f1; one | f1 -----+---------- | (-5,-12) (1 row) -- below -SELECT '' AS one, p.* FROM POINT_TBL p WHERE p.f1 <^ '(0.0, 0.0)'; +SELECT '' AS one, p.* FROM POINT_TBL p WHERE p.f1 <<| '(0.0, 0.0)'; one | f1 -----+---------- | (-5,-12) @@ -412,7 +412,7 @@ SELECT '' AS fifteen, p1.f1 AS point1, p2.f1 AS point2, (p1.f1 <-> p2.f1) AS dis -- put distance result into output to allow sorting with GEQ optimizer - tgl 97/05/10 SELECT '' AS three, p1.f1 AS point1, p2.f1 AS point2, (p1.f1 <-> p2.f1) AS distance FROM POINT_TBL p1, POINT_TBL p2 - WHERE (p1.f1 <-> p2.f1) > 3 and p1.f1 << p2.f1 and p1.f1 >^ p2.f1 + WHERE (p1.f1 <-> p2.f1) > 3 and p1.f1 << p2.f1 and p1.f1 |>> p2.f1 ORDER BY distance; three | point1 | point2 | distance -------+-------------------+-------------------+------------------ diff --git a/src/test/regress/sql/create_index.sql b/src/test/regress/sql/create_index.sql index b27643cad6..55326eb47b 100644 --- a/src/test/regress/sql/create_index.sql +++ b/src/test/regress/sql/create_index.sql @@ -136,9 +136,9 @@ SELECT count(*) FROM point_tbl p WHERE p.f1 << '(0.0, 0.0)'; SELECT count(*) FROM point_tbl p WHERE p.f1 >> '(0.0, 0.0)'; -SELECT count(*) FROM point_tbl p WHERE p.f1 <^ '(0.0, 0.0)'; +SELECT count(*) FROM point_tbl p WHERE p.f1 <<| '(0.0, 0.0)'; -SELECT count(*) FROM point_tbl p WHERE p.f1 >^ '(0.0, 0.0)'; +SELECT count(*) FROM point_tbl p WHERE p.f1 |>> '(0.0, 0.0)'; SELECT count(*) FROM point_tbl p WHERE p.f1 ~= '(-5, -12)'; @@ -220,12 +220,12 @@ SELECT count(*) FROM point_tbl p WHERE p.f1 >> '(0.0, 0.0)'; SELECT count(*) FROM point_tbl p WHERE p.f1 >> '(0.0, 0.0)'; EXPLAIN (COSTS OFF) -SELECT count(*) FROM point_tbl p WHERE p.f1 <^ '(0.0, 0.0)'; -SELECT count(*) FROM point_tbl p WHERE p.f1 <^ '(0.0, 0.0)'; +SELECT count(*) FROM point_tbl p WHERE p.f1 <<| '(0.0, 0.0)'; +SELECT count(*) FROM point_tbl p WHERE p.f1 <<| '(0.0, 0.0)'; EXPLAIN (COSTS OFF) -SELECT count(*) FROM point_tbl p WHERE p.f1 >^ '(0.0, 0.0)'; -SELECT count(*) FROM point_tbl p WHERE p.f1 >^ '(0.0, 0.0)'; +SELECT count(*) FROM point_tbl p WHERE p.f1 |>> '(0.0, 0.0)'; +SELECT count(*) FROM point_tbl p WHERE p.f1 |>> '(0.0, 0.0)'; EXPLAIN (COSTS OFF) SELECT count(*) FROM point_tbl p WHERE p.f1 ~= '(-5, -12)'; diff --git a/src/test/regress/sql/create_index_spgist.sql b/src/test/regress/sql/create_index_spgist.sql index 68632e3732..bff5f2d092 100644 --- a/src/test/regress/sql/create_index_spgist.sql +++ b/src/test/regress/sql/create_index_spgist.sql @@ -46,9 +46,9 @@ SELECT count(*) FROM quad_point_tbl WHERE p << '(5000, 4000)'; SELECT count(*) FROM quad_point_tbl WHERE p >> '(5000, 4000)'; -SELECT count(*) FROM quad_point_tbl WHERE p <^ '(5000, 4000)'; +SELECT count(*) FROM quad_point_tbl WHERE p <<| '(5000, 4000)'; -SELECT count(*) FROM quad_point_tbl WHERE p >^ '(5000, 4000)'; +SELECT count(*) FROM quad_point_tbl WHERE p |>> '(5000, 4000)'; SELECT count(*) FROM quad_point_tbl WHERE p ~= '(4585, 365)'; @@ -126,12 +126,12 @@ SELECT count(*) FROM quad_point_tbl WHERE p >> '(5000, 4000)'; SELECT count(*) FROM quad_point_tbl WHERE p >> '(5000, 4000)'; EXPLAIN (COSTS OFF) -SELECT count(*) FROM quad_point_tbl WHERE p <^ '(5000, 4000)'; -SELECT count(*) FROM quad_point_tbl WHERE p <^ '(5000, 4000)'; +SELECT count(*) FROM quad_point_tbl WHERE p <<| '(5000, 4000)'; +SELECT count(*) FROM quad_point_tbl WHERE p <<| '(5000, 4000)'; EXPLAIN (COSTS OFF) -SELECT count(*) FROM quad_point_tbl WHERE p >^ '(5000, 4000)'; -SELECT count(*) FROM quad_point_tbl WHERE p >^ '(5000, 4000)'; +SELECT count(*) FROM quad_point_tbl WHERE p |>> '(5000, 4000)'; +SELECT count(*) FROM quad_point_tbl WHERE p |>> '(5000, 4000)'; EXPLAIN (COSTS OFF) SELECT count(*) FROM quad_point_tbl WHERE p ~= '(4585, 365)'; @@ -184,12 +184,12 @@ SELECT count(*) FROM kd_point_tbl WHERE p >> '(5000, 4000)'; SELECT count(*) FROM kd_point_tbl WHERE p >> '(5000, 4000)'; EXPLAIN (COSTS OFF) -SELECT count(*) FROM kd_point_tbl WHERE p <^ '(5000, 4000)'; -SELECT count(*) FROM kd_point_tbl WHERE p <^ '(5000, 4000)'; +SELECT count(*) FROM kd_point_tbl WHERE p <<| '(5000, 4000)'; +SELECT count(*) FROM kd_point_tbl WHERE p <<| '(5000, 4000)'; EXPLAIN (COSTS OFF) -SELECT count(*) FROM kd_point_tbl WHERE p >^ '(5000, 4000)'; -SELECT count(*) FROM kd_point_tbl WHERE p >^ '(5000, 4000)'; +SELECT count(*) FROM kd_point_tbl WHERE p |>> '(5000, 4000)'; +SELECT count(*) FROM kd_point_tbl WHERE p |>> '(5000, 4000)'; EXPLAIN (COSTS OFF) SELECT count(*) FROM kd_point_tbl WHERE p ~= '(4585, 365)'; @@ -320,12 +320,12 @@ SELECT count(*) FROM quad_point_tbl WHERE p >> '(5000, 4000)'; SELECT count(*) FROM quad_point_tbl WHERE p >> '(5000, 4000)'; EXPLAIN (COSTS OFF) -SELECT count(*) FROM quad_point_tbl WHERE p <^ '(5000, 4000)'; -SELECT count(*) FROM quad_point_tbl WHERE p <^ '(5000, 4000)'; +SELECT count(*) FROM quad_point_tbl WHERE p <<| '(5000, 4000)'; +SELECT count(*) FROM quad_point_tbl WHERE p <<| '(5000, 4000)'; EXPLAIN (COSTS OFF) -SELECT count(*) FROM quad_point_tbl WHERE p >^ '(5000, 4000)'; -SELECT count(*) FROM quad_point_tbl WHERE p >^ '(5000, 4000)'; +SELECT count(*) FROM quad_point_tbl WHERE p |>> '(5000, 4000)'; +SELECT count(*) FROM quad_point_tbl WHERE p |>> '(5000, 4000)'; EXPLAIN (COSTS OFF) SELECT count(*) FROM quad_point_tbl WHERE p ~= '(4585, 365)'; @@ -348,12 +348,12 @@ SELECT count(*) FROM kd_point_tbl WHERE p >> '(5000, 4000)'; SELECT count(*) FROM kd_point_tbl WHERE p >> '(5000, 4000)'; EXPLAIN (COSTS OFF) -SELECT count(*) FROM kd_point_tbl WHERE p <^ '(5000, 4000)'; -SELECT count(*) FROM kd_point_tbl WHERE p <^ '(5000, 4000)'; +SELECT count(*) FROM kd_point_tbl WHERE p <<| '(5000, 4000)'; +SELECT count(*) FROM kd_point_tbl WHERE p <<| '(5000, 4000)'; EXPLAIN (COSTS OFF) -SELECT count(*) FROM kd_point_tbl WHERE p >^ '(5000, 4000)'; -SELECT count(*) FROM kd_point_tbl WHERE p >^ '(5000, 4000)'; +SELECT count(*) FROM kd_point_tbl WHERE p |>> '(5000, 4000)'; +SELECT count(*) FROM kd_point_tbl WHERE p |>> '(5000, 4000)'; EXPLAIN (COSTS OFF) SELECT count(*) FROM kd_point_tbl WHERE p ~= '(4585, 365)'; diff --git a/src/test/regress/sql/point.sql b/src/test/regress/sql/point.sql index 6a1ca12d5c..41366fb6b7 100644 --- a/src/test/regress/sql/point.sql +++ b/src/test/regress/sql/point.sql @@ -48,10 +48,10 @@ SELECT '' AS three, p.* FROM POINT_TBL p WHERE p.f1 << '(0.0, 0.0)'; SELECT '' AS three, p.* FROM POINT_TBL p WHERE '(0.0,0.0)' >> p.f1; -- above -SELECT '' AS one, p.* FROM POINT_TBL p WHERE '(0.0,0.0)' >^ p.f1; +SELECT '' AS one, p.* FROM POINT_TBL p WHERE '(0.0,0.0)' |>> p.f1; -- below -SELECT '' AS one, p.* FROM POINT_TBL p WHERE p.f1 <^ '(0.0, 0.0)'; +SELECT '' AS one, p.* FROM POINT_TBL p WHERE p.f1 <<| '(0.0, 0.0)'; -- equal SELECT '' AS one, p.* FROM POINT_TBL p WHERE p.f1 ~= '(5.1, 34.5)'; @@ -93,7 +93,7 @@ SELECT '' AS fifteen, p1.f1 AS point1, p2.f1 AS point2, (p1.f1 <-> p2.f1) AS dis -- put distance result into output to allow sorting with GEQ optimizer - tgl 97/05/10 SELECT '' AS three, p1.f1 AS point1, p2.f1 AS point2, (p1.f1 <-> p2.f1) AS distance FROM POINT_TBL p1, POINT_TBL p2 - WHERE (p1.f1 <-> p2.f1) > 3 and p1.f1 << p2.f1 and p1.f1 >^ p2.f1 + WHERE (p1.f1 <-> p2.f1) > 3 and p1.f1 << p2.f1 and p1.f1 |>> p2.f1 ORDER BY distance; -- Test that GiST indexes provide same behavior as sequential scan