Re: Bogus documentation for bogus geometric operators - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Bogus documentation for bogus geometric operators
Date
Msg-id 1941729.1606089146@sss.pgh.pa.us
Whole thread Raw
In response to Re: Bogus documentation for bogus geometric operators  (Pavel Borisov <pashkin.elfe@gmail.com>)
Responses Re: Bogus documentation for bogus geometric operators
List pgsql-hackers
Pavel Borisov <pashkin.elfe@gmail.com> writes:
>> undocumented.  Maybe instead of removing, change the text to be
>> "Deprecated, use the equivalent XXX operator instead."  Or we could
>> add a footnote similar to what was there for a previous renaming:

> The problem that this new <<| is equivalent to <^ only for points (To
> recap: the source of a problem is the same name of <^  operator for points
> and boxes with different meaning for these types).

I don't think it's that hard to be clear; see proposed wording below.

The other loose end is that I don't think we can take away the opclass
entries for the old spellings, unless we're willing to visibly break
people's queries by removing those operator names altogether.  That
doesn't seem like it'll fly when we haven't even deprecated the old
names yet.  So for now, we have to support both names in the opclasses.
I extended the patch to do that.

This version seems committable to me --- any thoughts?

            regards, tom lane

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
        </para>
        <para>
         Is first object strictly below second?
-        Available for <type>box</type>, <type>polygon</type>,
+        Available for <type>point</type>, <type>box</type>, <type>polygon</type>,
         <type>circle</type>.
        </para>
        <para>
@@ -10625,7 +10625,7 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
        </para>
        <para>
         Is first object strictly above second?
-        Available for <type>box</type>, <type>polygon</type>,
+        Available for <type>point</type>, <type>box</type>, <type>polygon</type>,
         <type>circle</type>.
        </para>
        <para>
@@ -10680,21 +10680,6 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
        </para></entry>
       </row>

-      <row>
-       <entry role="func_table_entry"><para role="func_signature">
-        <type>point</type> <literal><^</literal> <type>point</type>
-        <returnvalue>boolean</returnvalue>
-       </para>
-       <para>
-        Is first object strictly below second?
-        (This operator is misnamed; it should be <literal><<|</literal>.)
-       </para>
-       <para>
-        <literal>point '(1,0)' <^ point '(1,1)'</literal>
-        <returnvalue>t</returnvalue>
-       </para></entry>
-      </row>
-
       <row>
        <entry role="func_table_entry"><para role="func_signature">
         <type>box</type> <literal>>^</literal> <type>box</type>
@@ -10709,21 +10694,6 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
        </para></entry>
       </row>

-      <row>
-       <entry role="func_table_entry"><para role="func_signature">
-        <type>point</type> <literal>>^</literal> <type>point</type>
-        <returnvalue>boolean</returnvalue>
-       </para>
-       <para>
-        Is first object strictly above second?
-        (This operator is misnamed; it should be <literal>|>></literal>.)
-       </para>
-       <para>
-        <literal>point '(1,1)' >^ point '(1,0)'</literal>
-        <returnvalue>t</returnvalue>
-       </para></entry>
-      </row>
-
       <row>
        <entry role="func_table_entry"><para role="func_signature">
         <replaceable>geometric_type</replaceable> <literal>?#</literal> <replaceable>geometric_type</replaceable>
@@ -10877,6 +10847,18 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
     </para>
    </caution>

+   <note>
+    <para>
+     Before <productname>PostgreSQL</productname> 14, the point
+     is strictly below/above comparison operators <type>point</type>
+     <literal><<|</literal> <type>point</type> and <type>point</type>
+     <literal>|>></literal> <type>point</type> were respectively
+     called <literal><^</literal> and <literal>>^</literal>.  These
+     names are still available, but are deprecated and will eventually be
+     removed.
+    </para>
+   </note>
+
    <table id="functions-geometry-func-table">
     <title>Geometric Functions</title>
     <tgroup cols="1">
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 @@

      <row>
       <entry valign="middle" morerows="7"><literal>point_ops</literal></entry>
-      <entry><literal>>^ (point,point)</literal></entry>
+      <entry><literal>|>> (point,point)</literal></entry>
       <entry valign="middle" morerows="7"><literal><-> (point,point)</literal></entry>
      </row>
      <row><entry><literal><< (point,point)</literal></entry></row>
      <row><entry><literal>>> (point,point)</literal></entry></row>
-     <row><entry><literal><^ (point,point)</literal></entry></row>
+     <row><entry><literal><<| (point,point)</literal></entry></row>
      <row><entry><literal>~= (point,point)</literal></entry></row>
      <row><entry><literal><@ (point,box)</literal></entry></row>
      <row><entry><literal><@ (point,polygon)</literal></entry></row>
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 @@
      <row>
       <entry valign="middle" morerows="11"><literal>box_ops</literal></entry>
       <entry><literal><< (box,box)</literal></entry>
-      <entry valign="middle" morerows="11"><literal><-> (box,point)</literal></entry>
+      <entry valign="middle" morerows="11"><literal><-> (box,point)</literal></entry>
      </row>
      <row><entry><literal>&< (box,box)</literal></entry></row>
      <row><entry><literal>&> (box,box)</literal></entry></row>
@@ -92,12 +92,12 @@

      <row>
       <entry valign="middle" morerows="5"><literal>kd_point_ops</literal></entry>
-      <entry><literal>>^ (point,point)</literal></entry>
+      <entry><literal>|>> (point,point)</literal></entry>
       <entry valign="middle" morerows="5"><literal><-> (point,point)</literal></entry>
      </row>
      <row><entry><literal><< (point,point)</literal></entry></row>
      <row><entry><literal>>> (point,point)</literal></entry></row>
-     <row><entry><literal><^ (point,point)</literal></entry></row>
+     <row><entry><literal><<| (point,point)</literal></entry></row>
      <row><entry><literal>~= (point,point)</literal></entry></row>
      <row><entry><literal><@ (point,box)</literal></entry></row>

@@ -132,16 +132,16 @@
      <row><entry><literal><<| (polygon,polygon)</literal></entry></row>
      <row><entry><literal>&<| (polygon,polygon)</literal></entry></row>
      <row><entry><literal>|>> (polygon,polygon)</literal></entry></row>
-     <row><entry><literal>|&> (polygon,polygon)</literal></entry></row>
+     <row><entry><literal>|&> (polygon,polygon)</literal></entry></row>

      <row>
       <entry valign="middle" morerows="5"><literal>quad_point_ops</literal></entry>
-      <entry><literal>>^ (point,point)</literal></entry>
+      <entry><literal>|>> (point,point)</literal></entry>
       <entry valign="middle" morerows="5"><literal><-> (point,point)</literal></entry>
      </row>
      <row><entry><literal><< (point,point)</literal></entry></row>
      <row><entry><literal>>> (point,point)</literal></entry></row>
-     <row><entry><literal><^ (point,point)</literal></entry></row>
+     <row><entry><literal><<| (point,point)</literal></entry></row>
      <row><entry><literal>~= (point,point)</literal></entry></row>
      <row><entry><literal><@ (point,box)</literal></entry></row>

@@ -159,7 +159,7 @@
      <row><entry><literal>&< (anyrange,anyrange)</literal></entry></row>
      <row><entry><literal>&> (anyrange,anyrange)</literal></entry></row>
      <row><entry><literal>-|- (anyrange,anyrange)</literal></entry></row>
-
+
      <row>
       <entry valign="middle" morerows="9"><literal>text_ops</literal></entry>
       <entry><literal>= (text,text)</literal></entry>
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/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

pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: Why does create_gather_merge_plan need make_sort?
Next
From: Ian Lawrence Barwick
Date:
Subject: Re: [doc] improve tableoid description