Rename contrib contains/contained-by operators to @> and <@, per discussion.
authorTom Lane
Sun, 10 Sep 2006 17:36:52 +0000 (17:36 +0000)
committerTom Lane
Sun, 10 Sep 2006 17:36:52 +0000 (17:36 +0000)
36 files changed:
contrib/cube/README.cube
contrib/cube/cube.c
contrib/cube/cube.sql.in
contrib/cube/expected/cube.out
contrib/cube/expected/cube_1.out
contrib/cube/expected/cube_2.out
contrib/cube/sql/cube.sql
contrib/cube/uninstall_cube.sql
contrib/earthdistance/README.earthdistance
contrib/earthdistance/expected/earthdistance.out
contrib/earthdistance/sql/earthdistance.sql
contrib/hstore/README.hstore
contrib/hstore/expected/hstore.out
contrib/hstore/hstore.sql.in
contrib/hstore/sql/hstore.sql
contrib/intarray/README.intarray
contrib/intarray/_int.sql.in
contrib/intarray/_int_gin.c
contrib/intarray/_int_gist.c
contrib/intarray/_intbig_gist.c
contrib/intarray/expected/_int.out
contrib/intarray/sql/_int.sql
contrib/intarray/uninstall__int.sql
contrib/seg/README.seg
contrib/seg/expected/seg.out
contrib/seg/expected/seg_1.out
contrib/seg/seg.c
contrib/seg/seg.sql.in
contrib/seg/sql/seg.sql
contrib/seg/uninstall_seg.sql
contrib/tsearch2/expected/tsearch2.out
contrib/tsearch2/query_gist.c
contrib/tsearch2/sql/tsearch2.sql
contrib/tsearch2/tsearch.sql.in
contrib/tsearch2/untsearch.sql.in
doc/src/sgml/ref/create_opclass.sgml

index bc28c6ec3133403ace4c82be9807739a9aaabc7f..e83763f68e02849a4b22e93d00df69bbe58b8b43 100644 (file)
@@ -201,14 +201,20 @@ a && b        Overlaps
 
    The cubements a and b overlap.
 
-a @ b      Contains
+a @> b     Contains
 
    The cubement a contains the cubement b.
 
-a ~ b      Contained in
+a <@ b     Contained in
 
    The cubement a is contained in b.
 
+(Before PostgreSQL 8.2, the containment operators @> and <@ were
+respectively called @ and ~.  These names are still available, but are
+deprecated and will eventually be retired.  Notice that the old names
+are reversed from the convention formerly followed by the core geometric
+datatypes!)
+
 Although the mnemonics of the following operators is questionable, I
 preserved them to maintain visual consistency with other geometric
 data types defined in Postgres.
index a4472ee20e7ed8863ef14a671a5d5405c1189ca9..16ba5340fbfb34e4c8483f692dd49b0d3055ceed 100644 (file)
@@ -1,5 +1,5 @@
 /******************************************************************************
-  $PostgreSQL: pgsql/contrib/cube/cube.c,v 1.28 2006/07/27 21:55:09 tgl Exp $
+  $PostgreSQL: pgsql/contrib/cube/cube.c,v 1.29 2006/09/10 17:36:50 tgl Exp $
 
   This file contains routines that can be bound to a Postgres backend and
   called by the backend in the process of processing queries.  The calling
@@ -689,9 +689,11 @@ g_cube_leaf_consistent(NDBOX * key,
            retval = (bool) (cube_cmp_v0(key, query) == 0);
            break;
        case RTContainsStrategyNumber:
+       case RTOldContainsStrategyNumber:
            retval = (bool) cube_contains_v0(key, query);
            break;
        case RTContainedByStrategyNumber:
+       case RTOldContainedByStrategyNumber:
            retval = (bool) cube_contains_v0(query, key);
            break;
        default:
@@ -717,9 +719,11 @@ g_cube_internal_consistent(NDBOX * key,
            break;
        case RTSameStrategyNumber:
        case RTContainsStrategyNumber:
+       case RTOldContainsStrategyNumber:
            retval = (bool) cube_contains_v0(key, query);
            break;
        case RTContainedByStrategyNumber:
+       case RTOldContainedByStrategyNumber:
            retval = (bool) cube_overlap_v0(key, query);
            break;
        default:
index 3405c8e1f970fc40d774b12125cbabbd226dc876..c1697b0ea97a7d336130715900d5ebfd99f3c160 100644 (file)
@@ -243,6 +243,19 @@ CREATE OPERATOR <> (
    RESTRICT = neqsel, JOIN = neqjoinsel
 );
 
+CREATE OPERATOR @> (
+   LEFTARG = cube, RIGHTARG = cube, PROCEDURE = cube_contains,
+   COMMUTATOR = '<@',
+   RESTRICT = contsel, JOIN = contjoinsel
+);
+
+CREATE OPERATOR <@ (
+   LEFTARG = cube, RIGHTARG = cube, PROCEDURE = cube_contained,
+   COMMUTATOR = '@>',
+   RESTRICT = contsel, JOIN = contjoinsel
+);
+
+-- these are obsolete/deprecated:
 CREATE OPERATOR @ (
    LEFTARG = cube, RIGHTARG = cube, PROCEDURE = cube_contains,
    COMMUTATOR = '~',
@@ -308,8 +321,10 @@ CREATE OPERATOR CLASS gist_cube_ops
     DEFAULT FOR TYPE cube USING gist AS
    OPERATOR    3   && ,
    OPERATOR    6   = ,
-   OPERATOR    7   @ ,
-   OPERATOR    8   ~ ,
+   OPERATOR    7   @> ,
+   OPERATOR    8   <@ ,
+   OPERATOR    13  @ ,
+   OPERATOR    14  ~ ,
    FUNCTION    1   g_cube_consistent (internal, cube, int4),
    FUNCTION    2   g_cube_union (internal, internal),
    FUNCTION    3   g_cube_compress (internal),
index 59d5114861e75bdc8e11b976c0f19628934a5cc0..4f643573b512196668068de6fcbe81f94aa6a241 100644 (file)
@@ -627,91 +627,91 @@ SELECT '[(-1,-1,-1),(1,1,1)]'::cube && '[(2,1,1),(2,2,2)]'::cube AS bool;
 -- "contained in" (the left operand is the cube entirely enclosed by
 -- the right operand):
 --
-SELECT '0'::cube                 ~ '0'::cube                        AS bool;
+SELECT '0'::cube                 <@ '0'::cube                        AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0,0,0'::cube             ~ '0,0,0'::cube                    AS bool;
+SELECT '0,0,0'::cube             <@ '0,0,0'::cube                    AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0,0'::cube               ~ '0,0,1'::cube                    AS bool;
+SELECT '0,0'::cube               <@ '0,0,1'::cube                    AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0,0,0'::cube             ~ '0,0,1'::cube                    AS bool;
+SELECT '0,0,0'::cube             <@ '0,0,1'::cube                    AS bool;
  bool 
 ------
  f
 (1 row)
 
-SELECT '1,0,0'::cube             ~ '0,0,1'::cube                    AS bool;
+SELECT '1,0,0'::cube             <@ '0,0,1'::cube                    AS bool;
  bool 
 ------
  f
 (1 row)
 
-SELECT '(1,0,0),(0,0,1)'::cube   ~ '(1,0,0),(0,0,1)'::cube          AS bool;
+SELECT '(1,0,0),(0,0,1)'::cube   <@ '(1,0,0),(0,0,1)'::cube          AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(1,0,0),(0,0,1)'::cube   ~ '(-1,-1,-1),(1,1,1)'::cube       AS bool;
+SELECT '(1,0,0),(0,0,1)'::cube   <@ '(-1,-1,-1),(1,1,1)'::cube       AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(1,0,0),(0,0,1)'::cube   ~ '(-1,-1,-1,-1),(1,1,1,1)'::cube  AS bool;
+SELECT '(1,0,0),(0,0,1)'::cube   <@ '(-1,-1,-1,-1),(1,1,1,1)'::cube  AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0'::cube                 ~ '(-1),(1)'::cube                 AS bool;
+SELECT '0'::cube                 <@ '(-1),(1)'::cube                 AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '1'::cube                 ~ '(-1),(1)'::cube                 AS bool;
+SELECT '1'::cube                 <@ '(-1),(1)'::cube                 AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '-1'::cube                ~ '(-1),(1)'::cube                 AS bool;
+SELECT '-1'::cube                <@ '(-1),(1)'::cube                 AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1),(1)'::cube          ~ '(-1),(1)'::cube                 AS bool;
+SELECT '(-1),(1)'::cube          <@ '(-1),(1)'::cube                 AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1),(1)'::cube          ~ '(-1,-1),(1,1)'::cube            AS bool;
+SELECT '(-1),(1)'::cube          <@ '(-1,-1),(1,1)'::cube            AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-2),(1)'::cube          ~ '(-1),(1)'::cube                 AS bool;
+SELECT '(-2),(1)'::cube          <@ '(-1),(1)'::cube                 AS bool;
  bool 
 ------
  f
 (1 row)
 
-SELECT '(-2),(1)'::cube          ~ '(-1,-1),(1,1)'::cube            AS bool;
+SELECT '(-2),(1)'::cube          <@ '(-1,-1),(1,1)'::cube            AS bool;
  bool 
 ------
  f
@@ -720,91 +720,91 @@ SELECT '(-2),(1)'::cube          ~ '(-1,-1),(1,1)'::cube            AS bool;
 -- "contains" (the left operand is the cube that entirely encloses the
 -- right operand)
 --
-SELECT '0'::cube                        @ '0'::cube                 AS bool;
+SELECT '0'::cube                        @> '0'::cube                 AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0,0,0'::cube                    @ '0,0,0'::cube             AS bool;
+SELECT '0,0,0'::cube                    @> '0,0,0'::cube             AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0,0,1'::cube                    @ '0,0'::cube               AS bool;
+SELECT '0,0,1'::cube                    @> '0,0'::cube               AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0,0,1'::cube                    @ '0,0,0'::cube             AS bool;
+SELECT '0,0,1'::cube                    @> '0,0,0'::cube             AS bool;
  bool 
 ------
  f
 (1 row)
 
-SELECT '0,0,1'::cube                    @ '1,0,0'::cube             AS bool;
+SELECT '0,0,1'::cube                    @> '1,0,0'::cube             AS bool;
  bool 
 ------
  f
 (1 row)
 
-SELECT '(1,0,0),(0,0,1)'::cube          @ '(1,0,0),(0,0,1)'::cube   AS bool;
+SELECT '(1,0,0),(0,0,1)'::cube          @> '(1,0,0),(0,0,1)'::cube   AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1,-1,-1),(1,1,1)'::cube       @ '(1,0,0),(0,0,1)'::cube   AS bool;
+SELECT '(-1,-1,-1),(1,1,1)'::cube       @> '(1,0,0),(0,0,1)'::cube   AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1,-1,-1,-1),(1,1,1,1)'::cube  @ '(1,0,0),(0,0,1)'::cube   AS bool;
+SELECT '(-1,-1,-1,-1),(1,1,1,1)'::cube  @> '(1,0,0),(0,0,1)'::cube   AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1),(1)'::cube                 @ '0'::cube                 AS bool;
+SELECT '(-1),(1)'::cube                 @> '0'::cube                 AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1),(1)'::cube                 @ '1'::cube                 AS bool;
+SELECT '(-1),(1)'::cube                 @> '1'::cube                 AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1),(1)'::cube                 @ '-1'::cube                AS bool;
+SELECT '(-1),(1)'::cube                 @> '-1'::cube                AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1),(1)'::cube                 @ '(-1),(1)'::cube          AS bool;
+SELECT '(-1),(1)'::cube                 @> '(-1),(1)'::cube          AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1,-1),(1,1)'::cube            @ '(-1),(1)'::cube          AS bool;
+SELECT '(-1,-1),(1,1)'::cube            @> '(-1),(1)'::cube          AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1),(1)'::cube                 @ '(-2),(1)'::cube          AS bool;
+SELECT '(-1),(1)'::cube                 @> '(-2),(1)'::cube          AS bool;
  bool 
 ------
  f
 (1 row)
 
-SELECT '(-1,-1),(1,1)'::cube            @ '(-2),(1)'::cube          AS bool;
+SELECT '(-1,-1),(1,1)'::cube            @> '(-2),(1)'::cube          AS bool;
  bool 
 ------
  f
index a7a8d8d64f0c04360cb7fe393f4337e5af3609d8..49e6c3fa31d0c0ab1aa0a5ee8177fae82cedb9d9 100644 (file)
@@ -627,91 +627,91 @@ SELECT '[(-1,-1,-1),(1,1,1)]'::cube && '[(2,1,1),(2,2,2)]'::cube AS bool;
 -- "contained in" (the left operand is the cube entirely enclosed by
 -- the right operand):
 --
-SELECT '0'::cube                 ~ '0'::cube                        AS bool;
+SELECT '0'::cube                 <@ '0'::cube                        AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0,0,0'::cube             ~ '0,0,0'::cube                    AS bool;
+SELECT '0,0,0'::cube             <@ '0,0,0'::cube                    AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0,0'::cube               ~ '0,0,1'::cube                    AS bool;
+SELECT '0,0'::cube               <@ '0,0,1'::cube                    AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0,0,0'::cube             ~ '0,0,1'::cube                    AS bool;
+SELECT '0,0,0'::cube             <@ '0,0,1'::cube                    AS bool;
  bool 
 ------
  f
 (1 row)
 
-SELECT '1,0,0'::cube             ~ '0,0,1'::cube                    AS bool;
+SELECT '1,0,0'::cube             <@ '0,0,1'::cube                    AS bool;
  bool 
 ------
  f
 (1 row)
 
-SELECT '(1,0,0),(0,0,1)'::cube   ~ '(1,0,0),(0,0,1)'::cube          AS bool;
+SELECT '(1,0,0),(0,0,1)'::cube   <@ '(1,0,0),(0,0,1)'::cube          AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(1,0,0),(0,0,1)'::cube   ~ '(-1,-1,-1),(1,1,1)'::cube       AS bool;
+SELECT '(1,0,0),(0,0,1)'::cube   <@ '(-1,-1,-1),(1,1,1)'::cube       AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(1,0,0),(0,0,1)'::cube   ~ '(-1,-1,-1,-1),(1,1,1,1)'::cube  AS bool;
+SELECT '(1,0,0),(0,0,1)'::cube   <@ '(-1,-1,-1,-1),(1,1,1,1)'::cube  AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0'::cube                 ~ '(-1),(1)'::cube                 AS bool;
+SELECT '0'::cube                 <@ '(-1),(1)'::cube                 AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '1'::cube                 ~ '(-1),(1)'::cube                 AS bool;
+SELECT '1'::cube                 <@ '(-1),(1)'::cube                 AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '-1'::cube                ~ '(-1),(1)'::cube                 AS bool;
+SELECT '-1'::cube                <@ '(-1),(1)'::cube                 AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1),(1)'::cube          ~ '(-1),(1)'::cube                 AS bool;
+SELECT '(-1),(1)'::cube          <@ '(-1),(1)'::cube                 AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1),(1)'::cube          ~ '(-1,-1),(1,1)'::cube            AS bool;
+SELECT '(-1),(1)'::cube          <@ '(-1,-1),(1,1)'::cube            AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-2),(1)'::cube          ~ '(-1),(1)'::cube                 AS bool;
+SELECT '(-2),(1)'::cube          <@ '(-1),(1)'::cube                 AS bool;
  bool 
 ------
  f
 (1 row)
 
-SELECT '(-2),(1)'::cube          ~ '(-1,-1),(1,1)'::cube            AS bool;
+SELECT '(-2),(1)'::cube          <@ '(-1,-1),(1,1)'::cube            AS bool;
  bool 
 ------
  f
@@ -720,91 +720,91 @@ SELECT '(-2),(1)'::cube          ~ '(-1,-1),(1,1)'::cube            AS bool;
 -- "contains" (the left operand is the cube that entirely encloses the
 -- right operand)
 --
-SELECT '0'::cube                        @ '0'::cube                 AS bool;
+SELECT '0'::cube                        @> '0'::cube                 AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0,0,0'::cube                    @ '0,0,0'::cube             AS bool;
+SELECT '0,0,0'::cube                    @> '0,0,0'::cube             AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0,0,1'::cube                    @ '0,0'::cube               AS bool;
+SELECT '0,0,1'::cube                    @> '0,0'::cube               AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0,0,1'::cube                    @ '0,0,0'::cube             AS bool;
+SELECT '0,0,1'::cube                    @> '0,0,0'::cube             AS bool;
  bool 
 ------
  f
 (1 row)
 
-SELECT '0,0,1'::cube                    @ '1,0,0'::cube             AS bool;
+SELECT '0,0,1'::cube                    @> '1,0,0'::cube             AS bool;
  bool 
 ------
  f
 (1 row)
 
-SELECT '(1,0,0),(0,0,1)'::cube          @ '(1,0,0),(0,0,1)'::cube   AS bool;
+SELECT '(1,0,0),(0,0,1)'::cube          @> '(1,0,0),(0,0,1)'::cube   AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1,-1,-1),(1,1,1)'::cube       @ '(1,0,0),(0,0,1)'::cube   AS bool;
+SELECT '(-1,-1,-1),(1,1,1)'::cube       @> '(1,0,0),(0,0,1)'::cube   AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1,-1,-1,-1),(1,1,1,1)'::cube  @ '(1,0,0),(0,0,1)'::cube   AS bool;
+SELECT '(-1,-1,-1,-1),(1,1,1,1)'::cube  @> '(1,0,0),(0,0,1)'::cube   AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1),(1)'::cube                 @ '0'::cube                 AS bool;
+SELECT '(-1),(1)'::cube                 @> '0'::cube                 AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1),(1)'::cube                 @ '1'::cube                 AS bool;
+SELECT '(-1),(1)'::cube                 @> '1'::cube                 AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1),(1)'::cube                 @ '-1'::cube                AS bool;
+SELECT '(-1),(1)'::cube                 @> '-1'::cube                AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1),(1)'::cube                 @ '(-1),(1)'::cube          AS bool;
+SELECT '(-1),(1)'::cube                 @> '(-1),(1)'::cube          AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1,-1),(1,1)'::cube            @ '(-1),(1)'::cube          AS bool;
+SELECT '(-1,-1),(1,1)'::cube            @> '(-1),(1)'::cube          AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1),(1)'::cube                 @ '(-2),(1)'::cube          AS bool;
+SELECT '(-1),(1)'::cube                 @> '(-2),(1)'::cube          AS bool;
  bool 
 ------
  f
 (1 row)
 
-SELECT '(-1,-1),(1,1)'::cube            @ '(-2),(1)'::cube          AS bool;
+SELECT '(-1,-1),(1,1)'::cube            @> '(-2),(1)'::cube          AS bool;
  bool 
 ------
  f
index 0c1aba4972963ba5125348cafbb9997816dd7cee..ff6dbc4e5c74f956357b9790dc9d52744801efd4 100644 (file)
@@ -627,91 +627,91 @@ SELECT '[(-1,-1,-1),(1,1,1)]'::cube && '[(2,1,1),(2,2,2)]'::cube AS bool;
 -- "contained in" (the left operand is the cube entirely enclosed by
 -- the right operand):
 --
-SELECT '0'::cube                 ~ '0'::cube                        AS bool;
+SELECT '0'::cube                 <@ '0'::cube                        AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0,0,0'::cube             ~ '0,0,0'::cube                    AS bool;
+SELECT '0,0,0'::cube             <@ '0,0,0'::cube                    AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0,0'::cube               ~ '0,0,1'::cube                    AS bool;
+SELECT '0,0'::cube               <@ '0,0,1'::cube                    AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0,0,0'::cube             ~ '0,0,1'::cube                    AS bool;
+SELECT '0,0,0'::cube             <@ '0,0,1'::cube                    AS bool;
  bool 
 ------
  f
 (1 row)
 
-SELECT '1,0,0'::cube             ~ '0,0,1'::cube                    AS bool;
+SELECT '1,0,0'::cube             <@ '0,0,1'::cube                    AS bool;
  bool 
 ------
  f
 (1 row)
 
-SELECT '(1,0,0),(0,0,1)'::cube   ~ '(1,0,0),(0,0,1)'::cube          AS bool;
+SELECT '(1,0,0),(0,0,1)'::cube   <@ '(1,0,0),(0,0,1)'::cube          AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(1,0,0),(0,0,1)'::cube   ~ '(-1,-1,-1),(1,1,1)'::cube       AS bool;
+SELECT '(1,0,0),(0,0,1)'::cube   <@ '(-1,-1,-1),(1,1,1)'::cube       AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(1,0,0),(0,0,1)'::cube   ~ '(-1,-1,-1,-1),(1,1,1,1)'::cube  AS bool;
+SELECT '(1,0,0),(0,0,1)'::cube   <@ '(-1,-1,-1,-1),(1,1,1,1)'::cube  AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0'::cube                 ~ '(-1),(1)'::cube                 AS bool;
+SELECT '0'::cube                 <@ '(-1),(1)'::cube                 AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '1'::cube                 ~ '(-1),(1)'::cube                 AS bool;
+SELECT '1'::cube                 <@ '(-1),(1)'::cube                 AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '-1'::cube                ~ '(-1),(1)'::cube                 AS bool;
+SELECT '-1'::cube                <@ '(-1),(1)'::cube                 AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1),(1)'::cube          ~ '(-1),(1)'::cube                 AS bool;
+SELECT '(-1),(1)'::cube          <@ '(-1),(1)'::cube                 AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1),(1)'::cube          ~ '(-1,-1),(1,1)'::cube            AS bool;
+SELECT '(-1),(1)'::cube          <@ '(-1,-1),(1,1)'::cube            AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-2),(1)'::cube          ~ '(-1),(1)'::cube                 AS bool;
+SELECT '(-2),(1)'::cube          <@ '(-1),(1)'::cube                 AS bool;
  bool 
 ------
  f
 (1 row)
 
-SELECT '(-2),(1)'::cube          ~ '(-1,-1),(1,1)'::cube            AS bool;
+SELECT '(-2),(1)'::cube          <@ '(-1,-1),(1,1)'::cube            AS bool;
  bool 
 ------
  f
@@ -720,91 +720,91 @@ SELECT '(-2),(1)'::cube          ~ '(-1,-1),(1,1)'::cube            AS bool;
 -- "contains" (the left operand is the cube that entirely encloses the
 -- right operand)
 --
-SELECT '0'::cube                        @ '0'::cube                 AS bool;
+SELECT '0'::cube                        @> '0'::cube                 AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0,0,0'::cube                    @ '0,0,0'::cube             AS bool;
+SELECT '0,0,0'::cube                    @> '0,0,0'::cube             AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0,0,1'::cube                    @ '0,0'::cube               AS bool;
+SELECT '0,0,1'::cube                    @> '0,0'::cube               AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0,0,1'::cube                    @ '0,0,0'::cube             AS bool;
+SELECT '0,0,1'::cube                    @> '0,0,0'::cube             AS bool;
  bool 
 ------
  f
 (1 row)
 
-SELECT '0,0,1'::cube                    @ '1,0,0'::cube             AS bool;
+SELECT '0,0,1'::cube                    @> '1,0,0'::cube             AS bool;
  bool 
 ------
  f
 (1 row)
 
-SELECT '(1,0,0),(0,0,1)'::cube          @ '(1,0,0),(0,0,1)'::cube   AS bool;
+SELECT '(1,0,0),(0,0,1)'::cube          @> '(1,0,0),(0,0,1)'::cube   AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1,-1,-1),(1,1,1)'::cube       @ '(1,0,0),(0,0,1)'::cube   AS bool;
+SELECT '(-1,-1,-1),(1,1,1)'::cube       @> '(1,0,0),(0,0,1)'::cube   AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1,-1,-1,-1),(1,1,1,1)'::cube  @ '(1,0,0),(0,0,1)'::cube   AS bool;
+SELECT '(-1,-1,-1,-1),(1,1,1,1)'::cube  @> '(1,0,0),(0,0,1)'::cube   AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1),(1)'::cube                 @ '0'::cube                 AS bool;
+SELECT '(-1),(1)'::cube                 @> '0'::cube                 AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1),(1)'::cube                 @ '1'::cube                 AS bool;
+SELECT '(-1),(1)'::cube                 @> '1'::cube                 AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1),(1)'::cube                 @ '-1'::cube                AS bool;
+SELECT '(-1),(1)'::cube                 @> '-1'::cube                AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1),(1)'::cube                 @ '(-1),(1)'::cube          AS bool;
+SELECT '(-1),(1)'::cube                 @> '(-1),(1)'::cube          AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1,-1),(1,1)'::cube            @ '(-1),(1)'::cube          AS bool;
+SELECT '(-1,-1),(1,1)'::cube            @> '(-1),(1)'::cube          AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '(-1),(1)'::cube                 @ '(-2),(1)'::cube          AS bool;
+SELECT '(-1),(1)'::cube                 @> '(-2),(1)'::cube          AS bool;
  bool 
 ------
  f
 (1 row)
 
-SELECT '(-1,-1),(1,1)'::cube            @ '(-2),(1)'::cube          AS bool;
+SELECT '(-1,-1),(1,1)'::cube            @> '(-2),(1)'::cube          AS bool;
  bool 
 ------
  f
index 2c0e814d80e3269e7ef031408de5b65f6bd8cbdb..49d9869c533083125e543f3e31aff15afabb03e1 100644 (file)
@@ -180,41 +180,41 @@ SELECT '[(-1,-1,-1),(1,1,1)]'::cube && '[(2,1,1),(2,2,2)]'::cube AS bool;
 -- "contained in" (the left operand is the cube entirely enclosed by
 -- the right operand):
 --
-SELECT '0'::cube                 ~ '0'::cube                        AS bool;
-SELECT '0,0,0'::cube             ~ '0,0,0'::cube                    AS bool;
-SELECT '0,0'::cube               ~ '0,0,1'::cube                    AS bool;
-SELECT '0,0,0'::cube             ~ '0,0,1'::cube                    AS bool;
-SELECT '1,0,0'::cube             ~ '0,0,1'::cube                    AS bool;
-SELECT '(1,0,0),(0,0,1)'::cube   ~ '(1,0,0),(0,0,1)'::cube          AS bool;
-SELECT '(1,0,0),(0,0,1)'::cube   ~ '(-1,-1,-1),(1,1,1)'::cube       AS bool;
-SELECT '(1,0,0),(0,0,1)'::cube   ~ '(-1,-1,-1,-1),(1,1,1,1)'::cube  AS bool;
-SELECT '0'::cube                 ~ '(-1),(1)'::cube                 AS bool;
-SELECT '1'::cube                 ~ '(-1),(1)'::cube                 AS bool;
-SELECT '-1'::cube                ~ '(-1),(1)'::cube                 AS bool;
-SELECT '(-1),(1)'::cube          ~ '(-1),(1)'::cube                 AS bool;
-SELECT '(-1),(1)'::cube          ~ '(-1,-1),(1,1)'::cube            AS bool;
-SELECT '(-2),(1)'::cube          ~ '(-1),(1)'::cube                 AS bool;
-SELECT '(-2),(1)'::cube          ~ '(-1,-1),(1,1)'::cube            AS bool;
+SELECT '0'::cube                 <@ '0'::cube                        AS bool;
+SELECT '0,0,0'::cube             <@ '0,0,0'::cube                    AS bool;
+SELECT '0,0'::cube               <@ '0,0,1'::cube                    AS bool;
+SELECT '0,0,0'::cube             <@ '0,0,1'::cube                    AS bool;
+SELECT '1,0,0'::cube             <@ '0,0,1'::cube                    AS bool;
+SELECT '(1,0,0),(0,0,1)'::cube   <@ '(1,0,0),(0,0,1)'::cube          AS bool;
+SELECT '(1,0,0),(0,0,1)'::cube   <@ '(-1,-1,-1),(1,1,1)'::cube       AS bool;
+SELECT '(1,0,0),(0,0,1)'::cube   <@ '(-1,-1,-1,-1),(1,1,1,1)'::cube  AS bool;
+SELECT '0'::cube                 <@ '(-1),(1)'::cube                 AS bool;
+SELECT '1'::cube                 <@ '(-1),(1)'::cube                 AS bool;
+SELECT '-1'::cube                <@ '(-1),(1)'::cube                 AS bool;
+SELECT '(-1),(1)'::cube          <@ '(-1),(1)'::cube                 AS bool;
+SELECT '(-1),(1)'::cube          <@ '(-1,-1),(1,1)'::cube            AS bool;
+SELECT '(-2),(1)'::cube          <@ '(-1),(1)'::cube                 AS bool;
+SELECT '(-2),(1)'::cube          <@ '(-1,-1),(1,1)'::cube            AS bool;
 
 
 -- "contains" (the left operand is the cube that entirely encloses the
 -- right operand)
 --
-SELECT '0'::cube                        @ '0'::cube                 AS bool;
-SELECT '0,0,0'::cube                    @ '0,0,0'::cube             AS bool;
-SELECT '0,0,1'::cube                    @ '0,0'::cube               AS bool;
-SELECT '0,0,1'::cube                    @ '0,0,0'::cube             AS bool;
-SELECT '0,0,1'::cube                    @ '1,0,0'::cube             AS bool;
-SELECT '(1,0,0),(0,0,1)'::cube          @ '(1,0,0),(0,0,1)'::cube   AS bool;
-SELECT '(-1,-1,-1),(1,1,1)'::cube       @ '(1,0,0),(0,0,1)'::cube   AS bool;
-SELECT '(-1,-1,-1,-1),(1,1,1,1)'::cube  @ '(1,0,0),(0,0,1)'::cube   AS bool;
-SELECT '(-1),(1)'::cube                 @ '0'::cube                 AS bool;
-SELECT '(-1),(1)'::cube                 @ '1'::cube                 AS bool;
-SELECT '(-1),(1)'::cube                 @ '-1'::cube                AS bool;
-SELECT '(-1),(1)'::cube                 @ '(-1),(1)'::cube          AS bool;
-SELECT '(-1,-1),(1,1)'::cube            @ '(-1),(1)'::cube          AS bool;
-SELECT '(-1),(1)'::cube                 @ '(-2),(1)'::cube          AS bool;
-SELECT '(-1,-1),(1,1)'::cube            @ '(-2),(1)'::cube          AS bool;
+SELECT '0'::cube                        @> '0'::cube                 AS bool;
+SELECT '0,0,0'::cube                    @> '0,0,0'::cube             AS bool;
+SELECT '0,0,1'::cube                    @> '0,0'::cube               AS bool;
+SELECT '0,0,1'::cube                    @> '0,0,0'::cube             AS bool;
+SELECT '0,0,1'::cube                    @> '1,0,0'::cube             AS bool;
+SELECT '(1,0,0),(0,0,1)'::cube          @> '(1,0,0),(0,0,1)'::cube   AS bool;
+SELECT '(-1,-1,-1),(1,1,1)'::cube       @> '(1,0,0),(0,0,1)'::cube   AS bool;
+SELECT '(-1,-1,-1,-1),(1,1,1,1)'::cube  @> '(1,0,0),(0,0,1)'::cube   AS bool;
+SELECT '(-1),(1)'::cube                 @> '0'::cube                 AS bool;
+SELECT '(-1),(1)'::cube                 @> '1'::cube                 AS bool;
+SELECT '(-1),(1)'::cube                 @> '-1'::cube                AS bool;
+SELECT '(-1),(1)'::cube                 @> '(-1),(1)'::cube          AS bool;
+SELECT '(-1,-1),(1,1)'::cube            @> '(-1),(1)'::cube          AS bool;
+SELECT '(-1),(1)'::cube                 @> '(-2),(1)'::cube          AS bool;
+SELECT '(-1,-1),(1,1)'::cube            @> '(-2),(1)'::cube          AS bool;
 
 -- Test of distance function
 --
index 6548a7847035ad0c30fb8e71a0a8b9f1335cd8b1..784138acd58a058f3824fafef8ea512adadef03f 100644 (file)
@@ -22,6 +22,10 @@ DROP OPERATOR ~ (cube, cube);
 
 DROP OPERATOR @ (cube, cube);
 
+DROP OPERATOR <@ (cube, cube);
+
+DROP OPERATOR @> (cube, cube);
+
 DROP OPERATOR <> (cube, cube);
 
 DROP OPERATOR = (cube, cube);
index 470c7ea0b39ce568f647f7b0eb4114c7f333aded..9be761cf17a45d5207383e809a808b4bc9125866 100644 (file)
@@ -78,7 +78,7 @@ earth_distance(earth, earth) - Returns the great circle distance between
 two points on the surface of the Earth.
 
 earth_box(earth, float8)  - Returns a box suitable for an indexed search using
-the cube @ operator for points within a given great circle distance of a
+the cube @> operator for points within a given great circle distance of a
 location. Some points in this box are further than the specified great circle
 distance from the location so a second check using earth_distance should be
 made at the same time.
index 186f6178837cfd9788e1d8f5d376e1a777a38f8d..eeb6425e95e37df646766418ba6a5a3c13ddc1c4 100644 (file)
@@ -743,7 +743,7 @@ SELECT cube_ll_coord(earth_box(ll_to_earth(0,0),10*earth()),1)::numeric(20,5),
 -- Test for points that should be in bounding boxes.
 --
 SELECT earth_box(ll_to_earth(0,0),
-       earth_distance(ll_to_earth(0,0),ll_to_earth(0,1))*1.00001) @
+       earth_distance(ll_to_earth(0,0),ll_to_earth(0,1))*1.00001) @>
        ll_to_earth(0,1);
  ?column? 
 ----------
@@ -751,7 +751,7 @@ SELECT earth_box(ll_to_earth(0,0),
 (1 row)
 
 SELECT earth_box(ll_to_earth(0,0),
-       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.1))*1.00001) @
+       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.1))*1.00001) @>
        ll_to_earth(0,0.1);
  ?column? 
 ----------
@@ -759,7 +759,7 @@ SELECT earth_box(ll_to_earth(0,0),
 (1 row)
 
 SELECT earth_box(ll_to_earth(0,0),
-       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.01))*1.00001) @
+       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.01))*1.00001) @>
        ll_to_earth(0,0.01);
  ?column? 
 ----------
@@ -767,7 +767,7 @@ SELECT earth_box(ll_to_earth(0,0),
 (1 row)
 
 SELECT earth_box(ll_to_earth(0,0),
-       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.001))*1.00001) @
+       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.001))*1.00001) @>
        ll_to_earth(0,0.001);
  ?column? 
 ----------
@@ -775,7 +775,7 @@ SELECT earth_box(ll_to_earth(0,0),
 (1 row)
 
 SELECT earth_box(ll_to_earth(0,0),
-       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.0001))*1.00001) @
+       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.0001))*1.00001) @>
        ll_to_earth(0,0.0001);
  ?column? 
 ----------
@@ -783,7 +783,7 @@ SELECT earth_box(ll_to_earth(0,0),
 (1 row)
 
 SELECT earth_box(ll_to_earth(0,0),
-       earth_distance(ll_to_earth(0,0),ll_to_earth(0.0001,0.0001))*1.00001) @
+       earth_distance(ll_to_earth(0,0),ll_to_earth(0.0001,0.0001))*1.00001) @>
        ll_to_earth(0.0001,0.0001);
  ?column? 
 ----------
@@ -791,7 +791,7 @@ SELECT earth_box(ll_to_earth(0,0),
 (1 row)
 
 SELECT earth_box(ll_to_earth(45,45),
-       earth_distance(ll_to_earth(45,45),ll_to_earth(45.0001,45.0001))*1.00001) @
+       earth_distance(ll_to_earth(45,45),ll_to_earth(45.0001,45.0001))*1.00001) @>
        ll_to_earth(45.0001,45.0001);
  ?column? 
 ----------
@@ -799,7 +799,7 @@ SELECT earth_box(ll_to_earth(45,45),
 (1 row)
 
 SELECT earth_box(ll_to_earth(90,180),
-       earth_distance(ll_to_earth(90,180),ll_to_earth(90.0001,180.0001))*1.00001) @
+       earth_distance(ll_to_earth(90,180),ll_to_earth(90.0001,180.0001))*1.00001) @>
        ll_to_earth(90.0001,180.0001);
  ?column? 
 ----------
@@ -812,7 +812,7 @@ SELECT earth_box(ll_to_earth(90,180),
 -- but further away than the distance we are testing.
 --
 SELECT earth_box(ll_to_earth(0,0),
-       earth_distance(ll_to_earth(0,0),ll_to_earth(0,1))*.57735) @
+       earth_distance(ll_to_earth(0,0),ll_to_earth(0,1))*.57735) @>
        ll_to_earth(0,1);
  ?column? 
 ----------
@@ -820,7 +820,7 @@ SELECT earth_box(ll_to_earth(0,0),
 (1 row)
 
 SELECT earth_box(ll_to_earth(0,0),
-       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.1))*.57735) @
+       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.1))*.57735) @>
        ll_to_earth(0,0.1);
  ?column? 
 ----------
@@ -828,7 +828,7 @@ SELECT earth_box(ll_to_earth(0,0),
 (1 row)
 
 SELECT earth_box(ll_to_earth(0,0),
-       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.01))*.57735) @
+       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.01))*.57735) @>
        ll_to_earth(0,0.01);
  ?column? 
 ----------
@@ -836,7 +836,7 @@ SELECT earth_box(ll_to_earth(0,0),
 (1 row)
 
 SELECT earth_box(ll_to_earth(0,0),
-       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.001))*.57735) @
+       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.001))*.57735) @>
        ll_to_earth(0,0.001);
  ?column? 
 ----------
@@ -844,7 +844,7 @@ SELECT earth_box(ll_to_earth(0,0),
 (1 row)
 
 SELECT earth_box(ll_to_earth(0,0),
-       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.0001))*.57735) @
+       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.0001))*.57735) @>
        ll_to_earth(0,0.0001);
  ?column? 
 ----------
@@ -852,7 +852,7 @@ SELECT earth_box(ll_to_earth(0,0),
 (1 row)
 
 SELECT earth_box(ll_to_earth(0,0),
-       earth_distance(ll_to_earth(0,0),ll_to_earth(0.0001,0.0001))*.57735) @
+       earth_distance(ll_to_earth(0,0),ll_to_earth(0.0001,0.0001))*.57735) @>
        ll_to_earth(0.0001,0.0001);
  ?column? 
 ----------
@@ -860,7 +860,7 @@ SELECT earth_box(ll_to_earth(0,0),
 (1 row)
 
 SELECT earth_box(ll_to_earth(45,45),
-       earth_distance(ll_to_earth(45,45),ll_to_earth(45.0001,45.0001))*.57735) @
+       earth_distance(ll_to_earth(45,45),ll_to_earth(45.0001,45.0001))*.57735) @>
        ll_to_earth(45.0001,45.0001);
  ?column? 
 ----------
@@ -868,7 +868,7 @@ SELECT earth_box(ll_to_earth(45,45),
 (1 row)
 
 SELECT earth_box(ll_to_earth(90,180),
-       earth_distance(ll_to_earth(90,180),ll_to_earth(90.0001,180.0001))*.57735) @
+       earth_distance(ll_to_earth(90,180),ll_to_earth(90.0001,180.0001))*.57735) @>
        ll_to_earth(90.0001,180.0001);
  ?column? 
 ----------
index f36f1a8bdbe250ac0232b6a932db6ae10a688df1..ad68b5635dd6a33cd1a7872028cd52bdbd25590c 100644 (file)
@@ -224,28 +224,28 @@ SELECT cube_ll_coord(earth_box(ll_to_earth(0,0),10*earth()),1)::numeric(20,5),
 --
 
 SELECT earth_box(ll_to_earth(0,0),
-       earth_distance(ll_to_earth(0,0),ll_to_earth(0,1))*1.00001) @
+       earth_distance(ll_to_earth(0,0),ll_to_earth(0,1))*1.00001) @>
        ll_to_earth(0,1);
 SELECT earth_box(ll_to_earth(0,0),
-       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.1))*1.00001) @
+       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.1))*1.00001) @>
        ll_to_earth(0,0.1);
 SELECT earth_box(ll_to_earth(0,0),
-       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.01))*1.00001) @
+       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.01))*1.00001) @>
        ll_to_earth(0,0.01);
 SELECT earth_box(ll_to_earth(0,0),
-       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.001))*1.00001) @
+       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.001))*1.00001) @>
        ll_to_earth(0,0.001);
 SELECT earth_box(ll_to_earth(0,0),
-       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.0001))*1.00001) @
+       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.0001))*1.00001) @>
        ll_to_earth(0,0.0001);
 SELECT earth_box(ll_to_earth(0,0),
-       earth_distance(ll_to_earth(0,0),ll_to_earth(0.0001,0.0001))*1.00001) @
+       earth_distance(ll_to_earth(0,0),ll_to_earth(0.0001,0.0001))*1.00001) @>
        ll_to_earth(0.0001,0.0001);
 SELECT earth_box(ll_to_earth(45,45),
-       earth_distance(ll_to_earth(45,45),ll_to_earth(45.0001,45.0001))*1.00001) @
+       earth_distance(ll_to_earth(45,45),ll_to_earth(45.0001,45.0001))*1.00001) @>
        ll_to_earth(45.0001,45.0001);
 SELECT earth_box(ll_to_earth(90,180),
-       earth_distance(ll_to_earth(90,180),ll_to_earth(90.0001,180.0001))*1.00001) @
+       earth_distance(ll_to_earth(90,180),ll_to_earth(90.0001,180.0001))*1.00001) @>
        ll_to_earth(90.0001,180.0001);
 
 --
@@ -255,28 +255,28 @@ SELECT earth_box(ll_to_earth(90,180),
 --
 
 SELECT earth_box(ll_to_earth(0,0),
-       earth_distance(ll_to_earth(0,0),ll_to_earth(0,1))*.57735) @
+       earth_distance(ll_to_earth(0,0),ll_to_earth(0,1))*.57735) @>
        ll_to_earth(0,1);
 SELECT earth_box(ll_to_earth(0,0),
-       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.1))*.57735) @
+       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.1))*.57735) @>
        ll_to_earth(0,0.1);
 SELECT earth_box(ll_to_earth(0,0),
-       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.01))*.57735) @
+       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.01))*.57735) @>
        ll_to_earth(0,0.01);
 SELECT earth_box(ll_to_earth(0,0),
-       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.001))*.57735) @
+       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.001))*.57735) @>
        ll_to_earth(0,0.001);
 SELECT earth_box(ll_to_earth(0,0),
-       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.0001))*.57735) @
+       earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.0001))*.57735) @>
        ll_to_earth(0,0.0001);
 SELECT earth_box(ll_to_earth(0,0),
-       earth_distance(ll_to_earth(0,0),ll_to_earth(0.0001,0.0001))*.57735) @
+       earth_distance(ll_to_earth(0,0),ll_to_earth(0.0001,0.0001))*.57735) @>
        ll_to_earth(0.0001,0.0001);
 SELECT earth_box(ll_to_earth(45,45),
-       earth_distance(ll_to_earth(45,45),ll_to_earth(45.0001,45.0001))*.57735) @
+       earth_distance(ll_to_earth(45,45),ll_to_earth(45.0001,45.0001))*.57735) @>
        ll_to_earth(45.0001,45.0001);
 SELECT earth_box(ll_to_earth(90,180),
-       earth_distance(ll_to_earth(90,180),ll_to_earth(90.0001,180.0001))*.57735) @
+       earth_distance(ll_to_earth(90,180),ll_to_earth(90.0001,180.0001))*.57735) @>
        ll_to_earth(90.0001,180.0001);
 
 --
index 94379e9eb4c880619012878b0287f2e04b0af88b..601ae49259d7c46d836bb3227dd56416689be6ad 100644 (file)
@@ -46,23 +46,29 @@ select 'a'=>'b';
 ----------
   "a"=>"b"
 
-    * hstore @ hstore - contains operation, check if left operand contains right. 
+    * hstore @> hstore - contains operation, check if left operand contains right. 
 
-regression=# select 'a=>b, b=>1, c=>NULL'::hstore @ 'a=>c';
+regression=# select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>c';
  ?column? 
 ----------
  f
 (1 row)
 
-regression=# select 'a=>b, b=>1, c=>NULL'::hstore @ 'b=>1';
+regression=# select 'a=>b, b=>1, c=>NULL'::hstore @> 'b=>1';
  ?column? 
 ----------
  t
 (1 row)
 
-    * hstore ~ hstore - contained operation, check if left operand is contained 
+    * hstore <@ hstore - contained operation, check if left operand is contained 
     in right
 
+(Before PostgreSQL 8.2, the containment operators @> and <@ were
+respectively called @ and ~.  These names are still available, but are
+deprecated and will eventually be retired.  Notice that the old names
+are reversed from the convention formerly followed by the core geometric
+datatypes!)
+
 Functions
 
     * akeys(hstore) - returns all keys from hstore as array 
@@ -129,7 +135,7 @@ regression=# select isdefined('a=>NULL','a');
 
 Indices
 
-Module provides index support for '@' and '~' operations.
+Module provides index support for '@>' and '<@' operations.
 
 create index hidx on testhstore using gist(h);
 
index 06605e164877ef7a677fbc5947a8ad464f903313..61c96a4b976b9b0b4bcfd7adb997c6107455ac5b 100644 (file)
@@ -1,10 +1,11 @@
+--
+-- first, define the datatype.  Turn off echoing so that expected file
+-- does not depend on contents of hstore.sql.
+--
+SET client_min_messages = warning;
 \set ECHO none
-psql:hstore.sql:8: NOTICE:  type "hstore" is not yet defined
-DETAIL:  Creating a shell type definition.
-psql:hstore.sql:13: NOTICE:  argument type hstore is only a shell
-psql:hstore.sql:132: NOTICE:  type "ghstore" is not yet defined
-DETAIL:  Creating a shell type definition.
-psql:hstore.sql:137: NOTICE:  argument type ghstore is only a shell
+RESET client_min_messages;
+set escape_string_warning=off;
 --hstore;
 select ''::hstore;
  hstore 
@@ -483,50 +484,50 @@ select * from each('aaa=>bq, b=>NULL, ""=>1 ');
  aaa | bq
 (3 rows)
 
--- @
-select 'a=>b, b=>1, c=>NULL'::hstore @ 'a=>NULL';
+-- @>
+select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>NULL';
  ?column? 
 ----------
  t
 (1 row)
 
-select 'a=>b, b=>1, c=>NULL'::hstore @ 'a=>NULL, c=>NULL';
+select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>NULL, c=>NULL';
  ?column? 
 ----------
  t
 (1 row)
 
-select 'a=>b, b=>1, c=>NULL'::hstore @ 'a=>NULL, g=>NULL';
+select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>NULL, g=>NULL';
  ?column? 
 ----------
  f
 (1 row)
 
-select 'a=>b, b=>1, c=>NULL'::hstore @ 'g=>NULL';
+select 'a=>b, b=>1, c=>NULL'::hstore @> 'g=>NULL';
  ?column? 
 ----------
  f
 (1 row)
 
-select 'a=>b, b=>1, c=>NULL'::hstore @ 'a=>c';
+select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>c';
  ?column? 
 ----------
  f
 (1 row)
 
-select 'a=>b, b=>1, c=>NULL'::hstore @ 'a=>b';
+select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>b';
  ?column? 
 ----------
  t
 (1 row)
 
-select 'a=>b, b=>1, c=>NULL'::hstore @ 'a=>b, c=>NULL';
+select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>b, c=>NULL';
  ?column? 
 ----------
  t
 (1 row)
 
-select 'a=>b, b=>1, c=>NULL'::hstore @ 'a=>b, c=>q';
+select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>b, c=>q';
  ?column? 
 ----------
  f
@@ -534,19 +535,19 @@ select 'a=>b, b=>1, c=>NULL'::hstore @ 'a=>b, c=>q';
 
 CREATE TABLE testhstore (h hstore);
 \copy testhstore from 'data/hstore.data'
-select count(*) from testhstore where h @ 'wait=>NULL';
+select count(*) from testhstore where h @> 'wait=>NULL';
  count 
 -------
    189
 (1 row)
 
-select count(*) from testhstore where h @ 'wait=>CC';
+select count(*) from testhstore where h @> 'wait=>CC';
  count 
 -------
     15
 (1 row)
 
-select count(*) from testhstore where h @ 'wait=>CC, public=>t';
+select count(*) from testhstore where h @> 'wait=>CC, public=>t';
  count 
 -------
      2
@@ -554,19 +555,19 @@ select count(*) from testhstore where h @ 'wait=>CC, public=>t';
 
 create index hidx on testhstore using gist(h);
 set enable_seqscan=off;
-select count(*) from testhstore where h @ 'wait=>NULL';
+select count(*) from testhstore where h @> 'wait=>NULL';
  count 
 -------
    189
 (1 row)
 
-select count(*) from testhstore where h @ 'wait=>CC';
+select count(*) from testhstore where h @> 'wait=>CC';
  count 
 -------
     15
 (1 row)
 
-select count(*) from testhstore where h @ 'wait=>CC, public=>t';
+select count(*) from testhstore where h @> 'wait=>CC, public=>t';
  count 
 -------
      2
index 98ca9cfbda1ba5f204075919676056a7869888f9..c77fc7d4fb6162edf79ebf3f7cd72ecfa4f9026c 100644 (file)
@@ -61,6 +61,30 @@ RETURNS bool
 AS 'MODULE_PATHNAME'
 LANGUAGE 'C' with (isstrict,iscachable);
 
+CREATE FUNCTION hs_contained(hstore,hstore)
+RETURNS bool
+AS 'MODULE_PATHNAME'
+LANGUAGE 'C' with (isstrict,iscachable);
+
+CREATE OPERATOR @> (
+   LEFTARG = hstore,
+   RIGHTARG = hstore,
+   PROCEDURE = hs_contains,
+   COMMUTATOR = '<@',
+   RESTRICT = contsel,
+   JOIN = contjoinsel
+);
+
+CREATE OPERATOR <@ (
+   LEFTARG = hstore,
+   RIGHTARG = hstore,
+   PROCEDURE = hs_contained,
+   COMMUTATOR = '@>',
+   RESTRICT = contsel,
+   JOIN = contjoinsel
+);
+
+-- obsolete:
 CREATE OPERATOR @ (
    LEFTARG = hstore,
    RIGHTARG = hstore,
@@ -70,11 +94,6 @@ CREATE OPERATOR @ (
    JOIN = contjoinsel
 );
 
-CREATE FUNCTION hs_contained(hstore,hstore)
-RETURNS bool
-AS 'MODULE_PATHNAME'
-LANGUAGE 'C' with (isstrict,iscachable);
-
 CREATE OPERATOR ~ (
    LEFTARG = hstore,
    RIGHTARG = hstore,
@@ -181,8 +200,10 @@ LANGUAGE 'C';
 CREATE OPERATOR CLASS gist_hstore_ops
 DEFAULT FOR TYPE hstore USING gist
 AS
-        OPERATOR        7       @       RECHECK,
-        --OPERATOR        8       ~       RECHECK,
+        OPERATOR        7       @>       RECHECK,
+        --OPERATOR        8       <@       RECHECK,
+        OPERATOR        13      @       RECHECK,
+        --OPERATOR        14      ~       RECHECK,
         FUNCTION        1       ghstore_consistent (internal, internal, int4),
         FUNCTION        2       ghstore_union (internal, internal),
         FUNCTION        3       ghstore_compress (internal),
index 298ffb0893d5c42cc4a53b0b266eecaccc1e7496..0931616077b7573ffff62f168fdb0beeb2a31f98 100644 (file)
@@ -1,7 +1,15 @@
+--
+-- first, define the datatype.  Turn off echoing so that expected file
+-- does not depend on contents of hstore.sql.
+--
+SET client_min_messages = warning;
 \set ECHO none
 \i hstore.sql
-set escape_string_warning=off;
 \set ECHO all
+RESET client_min_messages;
+
+set escape_string_warning=off;
+
 --hstore;
 
 select ''::hstore;
@@ -103,29 +111,29 @@ select * from svals('');
 
 select * from each('aaa=>bq, b=>NULL, ""=>1 ');
 
--- @
-select 'a=>b, b=>1, c=>NULL'::hstore @ 'a=>NULL';
-select 'a=>b, b=>1, c=>NULL'::hstore @ 'a=>NULL, c=>NULL';
-select 'a=>b, b=>1, c=>NULL'::hstore @ 'a=>NULL, g=>NULL';
-select 'a=>b, b=>1, c=>NULL'::hstore @ 'g=>NULL';
-select 'a=>b, b=>1, c=>NULL'::hstore @ 'a=>c';
-select 'a=>b, b=>1, c=>NULL'::hstore @ 'a=>b';
-select 'a=>b, b=>1, c=>NULL'::hstore @ 'a=>b, c=>NULL';
-select 'a=>b, b=>1, c=>NULL'::hstore @ 'a=>b, c=>q';
+-- @>
+select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>NULL';
+select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>NULL, c=>NULL';
+select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>NULL, g=>NULL';
+select 'a=>b, b=>1, c=>NULL'::hstore @> 'g=>NULL';
+select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>c';
+select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>b';
+select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>b, c=>NULL';
+select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>b, c=>q';
 
 CREATE TABLE testhstore (h hstore);
 \copy testhstore from 'data/hstore.data'
 
-select count(*) from testhstore where h @ 'wait=>NULL';
-select count(*) from testhstore where h @ 'wait=>CC';
-select count(*) from testhstore where h @ 'wait=>CC, public=>t';
+select count(*) from testhstore where h @> 'wait=>NULL';
+select count(*) from testhstore where h @> 'wait=>CC';
+select count(*) from testhstore where h @> 'wait=>CC, public=>t';
 
 create index hidx on testhstore using gist(h);
 set enable_seqscan=off;
 
-select count(*) from testhstore where h @ 'wait=>NULL';
-select count(*) from testhstore where h @ 'wait=>CC';
-select count(*) from testhstore where h @ 'wait=>CC, public=>t';
+select count(*) from testhstore where h @> 'wait=>NULL';
+select count(*) from testhstore where h @> 'wait=>CC';
+select count(*) from testhstore where h @> 'wait=>CC, public=>t';
 
 select count(*) from (select (each(h)).key from testhstore) as wow ;
 select key, count(*) from (select (each(h)).key from testhstore) as wow group by key order by count desc, key;
index 9c3ecbe2615c09a11983ccf15118c377f69c7ba9..fd5fc8b685a6322f31be1c076f13215443fdbd63 100644 (file)
@@ -70,10 +70,10 @@ test=# select intset(1);
 
 OPERATIONS:
 
-  int[] && int[]  - overlap - returns TRUE if arrays has at least one common elements.
-  int[] @  int[]  - contains - returns TRUE if left array contains right array
-  int[] ~ int[]   - contained - returns TRUE if left array is contained in right array
-  # int[]         - return the number of elements in array
+  int[] && int[]  - overlap - returns TRUE if arrays have at least one common element
+  int[] @> int[]  - contains - returns TRUE if left array contains right array
+  int[] <@ int[]  - contained - returns TRUE if left array is contained in right array
+  # int[]         - returns the number of elements in array
   int[] + int     - push element to array ( add to end of array)
   int[] + int[]   - merge of arrays (right array added to the end of left one)
   int[] - int     - remove entries matched by right argument from array
@@ -81,8 +81,14 @@ OPERATIONS:
   int[] | int     - returns intarray - union of arguments
   int[] | int[]   - returns intarray as a union of two arrays
   int[] & int[]   - returns intersection of arrays
-  int[] @@ query_int  - returns TRUE if array satisfies query (like '1&(2|3)') 
-  query_int ~~ int[]  - -/-
+  int[] @@ query_int - returns TRUE if array satisfies query (like '1&(2|3)') 
+  query_int ~~ int[] - returns TRUE if array satisfies query (commutator of @@)
+
+(Before PostgreSQL 8.2, the containment operators @> and <@ were
+respectively called @ and ~.  These names are still available, but are
+deprecated and will eventually be retired.  Notice that the old names
+are reversed from the convention formerly followed by the core geometric
+datatypes!)
 
 CHANGES:
 
@@ -128,9 +134,9 @@ CREATE INDEX message_rdtree_idx on message using gist ( sections gist__int_ops);
   select message.mid from message where message.sections && '{1,2}';  
 
   -- select messages contains in sections 1 AND 2 - CONTAINS operator
-  select message.mid from message where message.sections @ '{1,2}';
+  select message.mid from message where message.sections @> '{1,2}';
   -- the same, CONTAINED operator
-  select message.mid from message where '{1,2}' ~ message.sections;
+  select message.mid from message where '{1,2}' <@ message.sections;
 
 BENCHMARK:
 
index 31fae745415f083a6dca42df7bc8f89d460d55f6..37530a9062c6402c7826fc0a3f5071e8c9538996 100644 (file)
@@ -12,12 +12,12 @@ BEGIN;
 CREATE FUNCTION bqarr_in(cstring)
 RETURNS query_int
 AS 'MODULE_PATHNAME'
-LANGUAGE C RETURNS NULL ON NULL INPUT;
+LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE;
 
 CREATE FUNCTION bqarr_out(query_int)
 RETURNS cstring
 AS 'MODULE_PATHNAME'
-LANGUAGE C RETURNS NULL ON NULL INPUT;
+LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE;
 
 CREATE TYPE query_int (
    INTERNALLENGTH = -1,
@@ -29,20 +29,20 @@ CREATE TYPE query_int (
 CREATE FUNCTION querytree(query_int)
 RETURNS text
 AS 'MODULE_PATHNAME'
-LANGUAGE C RETURNS NULL ON NULL INPUT;
+LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE;
 
 
 CREATE FUNCTION boolop(_int4, query_int)
 RETURNS bool
 AS 'MODULE_PATHNAME'
-LANGUAGE C RETURNS NULL ON NULL INPUT;
+LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE;
 
 COMMENT ON FUNCTION boolop(_int4, query_int) IS 'boolean operation with array';
 
 CREATE FUNCTION rboolop(query_int, _int4)
 RETURNS bool
 AS 'MODULE_PATHNAME'
-LANGUAGE C RETURNS NULL ON NULL INPUT;
+LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE;
 
 COMMENT ON FUNCTION rboolop(query_int, _int4) IS 'boolean operation with array';
 
@@ -74,35 +74,35 @@ CREATE OPERATOR ~~ (
 CREATE FUNCTION _int_contains(_int4, _int4)
 RETURNS bool
 AS 'MODULE_PATHNAME'
-LANGUAGE C RETURNS NULL ON NULL INPUT;
+LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE;
 
 COMMENT ON FUNCTION _int_contains(_int4, _int4) IS 'contains';
 
 CREATE FUNCTION _int_contained(_int4, _int4)
 RETURNS bool
 AS 'MODULE_PATHNAME'
-LANGUAGE C RETURNS NULL ON NULL INPUT;
+LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE;
 
 COMMENT ON FUNCTION _int_contained(_int4, _int4) IS 'contained in';
 
 CREATE FUNCTION _int_overlap(_int4, _int4)
 RETURNS bool
 AS 'MODULE_PATHNAME'
-LANGUAGE C RETURNS NULL ON NULL INPUT;
+LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE;
 
 COMMENT ON FUNCTION _int_overlap(_int4, _int4) IS 'overlaps';
 
 CREATE FUNCTION _int_same(_int4, _int4)
 RETURNS bool
 AS 'MODULE_PATHNAME'
-LANGUAGE C RETURNS NULL ON NULL INPUT;
+LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE;
 
 COMMENT ON FUNCTION _int_same(_int4, _int4) IS 'same as';
 
 CREATE FUNCTION _int_different(_int4, _int4)
 RETURNS bool
 AS 'MODULE_PATHNAME'
-LANGUAGE C RETURNS NULL ON NULL INPUT;
+LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE;
 
 COMMENT ON FUNCTION _int_different(_int4, _int4) IS 'different';
 
@@ -111,12 +111,12 @@ COMMENT ON FUNCTION _int_different(_int4, _int4) IS 'different';
 CREATE FUNCTION _int_union(_int4, _int4)
 RETURNS _int4
 AS 'MODULE_PATHNAME'
-LANGUAGE C RETURNS NULL ON NULL INPUT;
+LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE;
 
 CREATE FUNCTION _int_inter(_int4, _int4)
 RETURNS _int4
 AS 'MODULE_PATHNAME'
-LANGUAGE C RETURNS NULL ON NULL INPUT;
+LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE;
 
 --
 -- OPERATORS
@@ -153,6 +153,25 @@ CREATE OPERATOR && (
 -- JOIN = neqjoinsel
 --);
 
+CREATE OPERATOR @> (
+   LEFTARG = _int4,
+   RIGHTARG = _int4,
+   PROCEDURE = _int_contains,
+   COMMUTATOR = '<@',
+   RESTRICT = contsel,
+   JOIN = contjoinsel
+);
+
+CREATE OPERATOR <@ (
+   LEFTARG = _int4,
+   RIGHTARG = _int4,
+   PROCEDURE = _int_contained,
+   COMMUTATOR = '@>',
+   RESTRICT = contsel,
+   JOIN = contjoinsel
+);
+
+-- obsolete:
 CREATE OPERATOR @ (
    LEFTARG = _int4,
    RIGHTARG = _int4,
@@ -347,8 +366,10 @@ CREATE OPERATOR CLASS gist__int_ops
 DEFAULT FOR TYPE _int4 USING gist AS
    OPERATOR    3   &&,
    OPERATOR    6   = (anyarray, anyarray)  RECHECK,
-   OPERATOR    7   @,
-   OPERATOR    8   ~,
+   OPERATOR    7   @>,
+   OPERATOR    8   <@,
+   OPERATOR    13  @,
+   OPERATOR    14  ~,
    OPERATOR    20  @@ (_int4, query_int),
    FUNCTION    1   g_int_consistent (internal, _int4, int4),
    FUNCTION    2   g_int_union (internal, internal),
@@ -367,12 +388,12 @@ DEFAULT FOR TYPE _int4 USING gist AS
 CREATE FUNCTION _intbig_in(cstring)
 RETURNS intbig_gkey
 AS 'MODULE_PATHNAME'
-LANGUAGE C RETURNS NULL ON NULL INPUT;
+LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE;
 
 CREATE FUNCTION _intbig_out(intbig_gkey)
 RETURNS cstring
 AS 'MODULE_PATHNAME'
-LANGUAGE C RETURNS NULL ON NULL INPUT;
+LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE;
 
 CREATE TYPE intbig_gkey (
         INTERNALLENGTH = -1,
@@ -422,8 +443,10 @@ FOR TYPE _int4 USING gist
 AS
    OPERATOR    3   &&  RECHECK,
    OPERATOR    6   = (anyarray, anyarray)  RECHECK,
-   OPERATOR    7   @   RECHECK,
-   OPERATOR    8   ~   RECHECK,
+   OPERATOR    7   @>  RECHECK,
+   OPERATOR    8   <@  RECHECK,
+   OPERATOR    13  @   RECHECK,
+   OPERATOR    14  ~   RECHECK,
    OPERATOR    20  @@ (_int4, query_int)   RECHECK,
    FUNCTION    1   g_intbig_consistent (internal, internal, int4),
    FUNCTION    2   g_intbig_union (internal, internal),
@@ -455,8 +478,10 @@ DEFAULT FOR TYPE _int4 USING gin
 AS
    OPERATOR    3   &&,
    OPERATOR    6   = (anyarray, anyarray)  RECHECK,
-   OPERATOR    7   @,
-   OPERATOR    8   ~   RECHECK,
+   OPERATOR    7   @>,
+   OPERATOR    8   <@  RECHECK,
+   OPERATOR    13  @,
+   OPERATOR    14  ~   RECHECK,
    OPERATOR    20  @@ (_int4, query_int),
    FUNCTION    1   btint4cmp (int4, int4),
    FUNCTION    2   ginarrayextract (anyarray, internal),
index dfbb6e2ff1d04040d5788aa321f86a5c28bae849..2a2830e578ddf58af5db5ff002416d9b0939efb2 100644 (file)
@@ -68,12 +68,14 @@ ginint4_consistent(PG_FUNCTION_ARGS) {
     switch( strategy ) {
         case RTOverlapStrategyNumber:
         case RTContainedByStrategyNumber:
+        case RTOldContainedByStrategyNumber:
             /* at least one element in check[] is true, so result = true */
 
             res = TRUE;
             break;
         case RTSameStrategyNumber:
         case RTContainsStrategyNumber:
+        case RTOldContainsStrategyNumber:
             res = TRUE;
            do {
                ArrayType   *query = PG_GETARG_ARRAYTYPE_P(2);
index df5ae03e54d9c2c8e78bcf5704d365795311cf31..71c9ad0cec517dd3af090abe2c6597f4d91df439 100644 (file)
@@ -72,10 +72,12 @@ g_int_consistent(PG_FUNCTION_ARGS)
                                            query);
            break;
        case RTContainsStrategyNumber:
+       case RTOldContainsStrategyNumber:
            retval = inner_int_contains((ArrayType *) DatumGetPointer(entry->key),
                                        query);
            break;
        case RTContainedByStrategyNumber:
+       case RTOldContainedByStrategyNumber:
            if (GIST_LEAF(entry))
                retval = inner_int_contains(query,
                                  (ArrayType *) DatumGetPointer(entry->key));
index 626421f83c357caf2cb2bc204c2cbae172639a96..b25814c7ce7ba3f74a9b31104497918febc4dd52 100644 (file)
@@ -560,9 +560,11 @@ g_intbig_consistent(PG_FUNCTION_ARGS)
                retval = _intbig_contains((GISTTYPE *) DatumGetPointer(entry->key), query);
            break;
        case RTContainsStrategyNumber:
+       case RTOldContainsStrategyNumber:
            retval = _intbig_contains((GISTTYPE *) DatumGetPointer(entry->key), query);
            break;
        case RTContainedByStrategyNumber:
+       case RTOldContainedByStrategyNumber:
            if (GIST_LEAF(entry))
            {
                int         i,
index e45ed3cfa83a9ff40d74a086e9dce15b00df23ad..140aa20a172c2d9df8d106c70bf2639d8e14f529 100644 (file)
@@ -2,13 +2,9 @@
 -- first, define the datatype.  Turn off echoing so that expected file
 -- does not depend on contents of _int.sql.
 --
+SET client_min_messages = warning;
 \set ECHO none
-psql:_int.sql:15: NOTICE:  type "query_int" is not yet defined
-DETAIL:  Creating a shell type definition.
-psql:_int.sql:20: NOTICE:  argument type query_int is only a shell
-psql:_int.sql:370: NOTICE:  type "intbig_gkey" is not yet defined
-DETAIL:  Creating a shell type definition.
-psql:_int.sql:375: NOTICE:  argument type intbig_gkey is only a shell
+RESET client_min_messages;
 SELECT intset(1234);
  intset 
 --------
@@ -384,7 +380,7 @@ SELECT count(*) from test__int WHERE a @@ '23|50';
    403
 (1 row)
 
-SELECT count(*) from test__int WHERE a @ '{23,50}';
+SELECT count(*) from test__int WHERE a @> '{23,50}';
  count 
 -------
     12
@@ -396,7 +392,7 @@ SELECT count(*) from test__int WHERE a @@ '23&50';
     12
 (1 row)
 
-SELECT count(*) from test__int WHERE a @ '{20,23}';
+SELECT count(*) from test__int WHERE a @> '{20,23}';
  count 
 -------
     12
@@ -408,7 +404,7 @@ SELECT count(*) from test__int WHERE a @@ '50&68';
      9
 (1 row)
 
-SELECT count(*) from test__int WHERE a @ '{20,23}' or a @ '{50,68}';
+SELECT count(*) from test__int WHERE a @> '{20,23}' or a @> '{50,68}';
  count 
 -------
     21
@@ -433,7 +429,7 @@ SELECT count(*) from test__int WHERE a @@ '23|50';
    403
 (1 row)
 
-SELECT count(*) from test__int WHERE a @ '{23,50}';
+SELECT count(*) from test__int WHERE a @> '{23,50}';
  count 
 -------
     12
@@ -445,7 +441,7 @@ SELECT count(*) from test__int WHERE a @@ '23&50';
     12
 (1 row)
 
-SELECT count(*) from test__int WHERE a @ '{20,23}';
+SELECT count(*) from test__int WHERE a @> '{20,23}';
  count 
 -------
     12
@@ -457,7 +453,7 @@ SELECT count(*) from test__int WHERE a @@ '50&68';
      9
 (1 row)
 
-SELECT count(*) from test__int WHERE a @ '{20,23}' or a @ '{50,68}';
+SELECT count(*) from test__int WHERE a @> '{20,23}' or a @> '{50,68}';
  count 
 -------
     21
@@ -483,7 +479,7 @@ SELECT count(*) from test__int WHERE a @@ '23|50';
    403
 (1 row)
 
-SELECT count(*) from test__int WHERE a @ '{23,50}';
+SELECT count(*) from test__int WHERE a @> '{23,50}';
  count 
 -------
     12
@@ -495,7 +491,7 @@ SELECT count(*) from test__int WHERE a @@ '23&50';
     12
 (1 row)
 
-SELECT count(*) from test__int WHERE a @ '{20,23}';
+SELECT count(*) from test__int WHERE a @> '{20,23}';
  count 
 -------
     12
@@ -507,7 +503,7 @@ SELECT count(*) from test__int WHERE a @@ '50&68';
      9
 (1 row)
 
-SELECT count(*) from test__int WHERE a @ '{20,23}' or a @ '{50,68}';
+SELECT count(*) from test__int WHERE a @> '{20,23}' or a @> '{50,68}';
  count 
 -------
     21
@@ -533,7 +529,7 @@ SELECT count(*) from test__int WHERE a @@ '23|50';
    403
 (1 row)
 
-SELECT count(*) from test__int WHERE a @ '{23,50}';
+SELECT count(*) from test__int WHERE a @> '{23,50}';
  count 
 -------
     12
@@ -545,7 +541,7 @@ SELECT count(*) from test__int WHERE a @@ '23&50';
     12
 (1 row)
 
-SELECT count(*) from test__int WHERE a @ '{20,23}';
+SELECT count(*) from test__int WHERE a @> '{20,23}';
  count 
 -------
     12
@@ -557,7 +553,7 @@ SELECT count(*) from test__int WHERE a @@ '50&68';
      9
 (1 row)
 
-SELECT count(*) from test__int WHERE a @ '{20,23}' or a @ '{50,68}';
+SELECT count(*) from test__int WHERE a @> '{20,23}' or a @> '{50,68}';
  count 
 -------
     21
index e04b88e7512b6a6e2103852936332fd9336e9045..481754057e49e2e46f4bc8a450316b022cb2206c 100644 (file)
@@ -2,9 +2,11 @@
 -- first, define the datatype.  Turn off echoing so that expected file
 -- does not depend on contents of _int.sql.
 --
+SET client_min_messages = warning;
 \set ECHO none
 \i _int.sql
 \set ECHO all
+RESET client_min_messages;
 
 SELECT intset(1234);
 SELECT icount('{1234234,234234}');
@@ -78,22 +80,22 @@ CREATE TABLE test__int( a int[] );
 
 SELECT count(*) from test__int WHERE a && '{23,50}';
 SELECT count(*) from test__int WHERE a @@ '23|50';
-SELECT count(*) from test__int WHERE a @ '{23,50}';
+SELECT count(*) from test__int WHERE a @> '{23,50}';
 SELECT count(*) from test__int WHERE a @@ '23&50';
-SELECT count(*) from test__int WHERE a @ '{20,23}';
+SELECT count(*) from test__int WHERE a @> '{20,23}';
 SELECT count(*) from test__int WHERE a @@ '50&68';
-SELECT count(*) from test__int WHERE a @ '{20,23}' or a @ '{50,68}';
+SELECT count(*) from test__int WHERE a @> '{20,23}' or a @> '{50,68}';
 SELECT count(*) from test__int WHERE a @@ '(20&23)|(50&68)';
 
 CREATE INDEX text_idx on test__int using gist ( a gist__int_ops );
 
 SELECT count(*) from test__int WHERE a && '{23,50}';
 SELECT count(*) from test__int WHERE a @@ '23|50';
-SELECT count(*) from test__int WHERE a @ '{23,50}';
+SELECT count(*) from test__int WHERE a @> '{23,50}';
 SELECT count(*) from test__int WHERE a @@ '23&50';
-SELECT count(*) from test__int WHERE a @ '{20,23}';
+SELECT count(*) from test__int WHERE a @> '{20,23}';
 SELECT count(*) from test__int WHERE a @@ '50&68';
-SELECT count(*) from test__int WHERE a @ '{20,23}' or a @ '{50,68}';
+SELECT count(*) from test__int WHERE a @> '{20,23}' or a @> '{50,68}';
 SELECT count(*) from test__int WHERE a @@ '(20&23)|(50&68)';
 
 DROP INDEX text_idx;
@@ -101,11 +103,11 @@ CREATE INDEX text_idx on test__int using gist ( a gist__intbig_ops );
 
 SELECT count(*) from test__int WHERE a && '{23,50}';
 SELECT count(*) from test__int WHERE a @@ '23|50';
-SELECT count(*) from test__int WHERE a @ '{23,50}';
+SELECT count(*) from test__int WHERE a @> '{23,50}';
 SELECT count(*) from test__int WHERE a @@ '23&50';
-SELECT count(*) from test__int WHERE a @ '{20,23}';
+SELECT count(*) from test__int WHERE a @> '{20,23}';
 SELECT count(*) from test__int WHERE a @@ '50&68';
-SELECT count(*) from test__int WHERE a @ '{20,23}' or a @ '{50,68}';
+SELECT count(*) from test__int WHERE a @> '{20,23}' or a @> '{50,68}';
 SELECT count(*) from test__int WHERE a @@ '(20&23)|(50&68)';
 
 DROP INDEX text_idx;
@@ -113,9 +115,9 @@ CREATE INDEX text_idx on test__int using gin ( a );
 
 SELECT count(*) from test__int WHERE a && '{23,50}';
 SELECT count(*) from test__int WHERE a @@ '23|50';
-SELECT count(*) from test__int WHERE a @ '{23,50}';
+SELECT count(*) from test__int WHERE a @> '{23,50}';
 SELECT count(*) from test__int WHERE a @@ '23&50';
-SELECT count(*) from test__int WHERE a @ '{20,23}';
+SELECT count(*) from test__int WHERE a @> '{20,23}';
 SELECT count(*) from test__int WHERE a @@ '50&68';
-SELECT count(*) from test__int WHERE a @ '{20,23}' or a @ '{50,68}';
+SELECT count(*) from test__int WHERE a @> '{20,23}' or a @> '{50,68}';
 SELECT count(*) from test__int WHERE a @@ '(20&23)|(50&68)';
index 49522b7c6c7ba55f41c8ee0fb9be0883d3dcc2b2..6f5b863fea21d6a427af6fd8b10305a6865fb331 100644 (file)
@@ -1,5 +1,11 @@
 SET search_path = public;
 
+DROP OPERATOR CLASS gin__int_ops USING gin;
+
+DROP FUNCTION ginint4_queryextract(internal, internal, int2);
+
+DROP FUNCTION ginint4_consistent(internal, int2, internal);
+
 DROP OPERATOR CLASS gist__intbig_ops USING gist;
 
 DROP FUNCTION g_intbig_same(internal, internal, internal);
@@ -82,6 +88,10 @@ DROP FUNCTION icount(_int4);
 
 DROP FUNCTION intset(int4);
 
+DROP OPERATOR <@ (_int4, _int4);
+
+DROP OPERATOR @> (_int4, _int4);
+
 DROP OPERATOR ~ (_int4, _int4);
 
 DROP OPERATOR @ (_int4, _int4);
index 9e741756c33665d6978593a00eeac08f22ced693..7fa29c44e08312cafad02198af3ef26b05017940 100644 (file)
@@ -257,16 +257,22 @@ The operators supported by the GiST access method include:
 
    The segments [a, b] and [c, d] overlap.
 
-[a, b] @ [c, d]        Contains
+[a, b] @> [c, d]       Contains
 
    The segment [a, b] contains the segment [c, d], that is, 
    a <= c and b >= d
 
-[a, b] @ [c, d]        Contained in
+[a, b] <@ [c, d]       Contained in
 
    The segment [a, b] is contained in [c, d], that is, 
    a >= c and b <= d
 
+(Before PostgreSQL 8.2, the containment operators @> and <@ were
+respectively called @ and ~.  These names are still available, but are
+deprecated and will eventually be retired.  Notice that the old names
+are reversed from the convention formerly followed by the core geometric
+datatypes!)
+
 Although the mnemonics of the following operators is questionable, I
 preserved them to maintain visual consistency with other geometric
 data types defined in Postgres.
index 06971ae265ba6f863a5dd4a9f3686cbfb1015afb..de410490bc7187c6de1f12f134d45527d2d7b0c3 100644 (file)
@@ -5,10 +5,9 @@
 -- first, define the datatype.  Turn off echoing so that expected file
 -- does not depend on contents of seg.sql.
 --
+SET client_min_messages = warning;
 \set ECHO none
-psql:seg.sql:10: NOTICE:  type "seg" is not yet defined
-DETAIL:  Creating a shell type definition.
-psql:seg.sql:15: NOTICE:  argument type seg is only a shell
+RESET client_min_messages;
 --
 -- testing the input and output functions
 --
@@ -814,49 +813,49 @@ SELECT '2 .. 3'::seg >> '0 .. 1'::seg AS bool;
 
 -- "contained in" (the left value belongs within the interval specified in the right value):
 --
-SELECT '0'::seg        ~ '0'::seg AS bool;
+SELECT '0'::seg        <@ '0'::seg AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0'::seg        ~ '0 ..'::seg AS bool;
+SELECT '0'::seg        <@ '0 ..'::seg AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0'::seg        ~ '.. 0'::seg AS bool;
+SELECT '0'::seg        <@ '.. 0'::seg AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0'::seg        ~ '-1 .. 1'::seg AS bool;
+SELECT '0'::seg        <@ '-1 .. 1'::seg AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0'::seg        ~ '-1 .. 1'::seg AS bool;
+SELECT '0'::seg        <@ '-1 .. 1'::seg AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '-1'::seg       ~ '-1 .. 1'::seg AS bool;
+SELECT '-1'::seg       <@ '-1 .. 1'::seg AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '1'::seg        ~ '-1 .. 1'::seg AS bool;
+SELECT '1'::seg        <@ '-1 .. 1'::seg AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '-1 .. 1'::seg  ~ '-1 .. 1'::seg AS bool;
+SELECT '-1 .. 1'::seg  <@ '-1 .. 1'::seg AS bool;
  bool 
 ------
  t
@@ -864,43 +863,43 @@ SELECT '-1 .. 1'::seg  ~ '-1 .. 1'::seg AS bool;
 
 -- "contains" (the left value contains the interval specified in the right value):
 --
-SELECT '0'::seg @ '0'::seg AS bool;
+SELECT '0'::seg @> '0'::seg AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0 .. '::seg ~ '0'::seg AS bool;
+SELECT '0 .. '::seg <@ '0'::seg AS bool;
  bool 
 ------
  f
 (1 row)
 
-SELECT '.. 0'::seg ~ '0'::seg AS bool;
+SELECT '.. 0'::seg <@ '0'::seg AS bool;
  bool 
 ------
  f
 (1 row)
 
-SELECT '-1 .. 1'::seg ~ '0'::seg AS bool;
+SELECT '-1 .. 1'::seg <@ '0'::seg AS bool;
  bool 
 ------
  f
 (1 row)
 
-SELECT '0'::seg ~ '-1 .. 1'::seg AS bool;
+SELECT '0'::seg <@ '-1 .. 1'::seg AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '-1'::seg ~ '-1 .. 1'::seg AS bool;
+SELECT '-1'::seg <@ '-1 .. 1'::seg AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '1'::seg ~ '-1 .. 1'::seg AS bool;
+SELECT '1'::seg <@ '-1 .. 1'::seg AS bool;
  bool 
 ------
  t
@@ -911,14 +910,14 @@ SELECT '1'::seg ~ '-1 .. 1'::seg AS bool;
 CREATE TABLE test_seg (s seg);
 \copy test_seg from 'data/test_seg.data'
 CREATE INDEX test_seg_ix ON test_seg USING gist (s);
-SELECT count(*) FROM test_seg WHERE s @ '11..11.3';
+SELECT count(*) FROM test_seg WHERE s @> '11..11.3';
  count 
 -------
    143
 (1 row)
 
 -- Test sorting 
-SELECT * FROM test_seg WHERE s @ '11..11.3' GROUP BY s;
+SELECT * FROM test_seg WHERE s @> '11..11.3' GROUP BY s;
         s        
 -----------------
  .. 4.0e1
index 2c446b7cc6e1696e42cc46b8b1ebc3e4b80e7a1d..446714f8ba020ec24eca915a486c39e6b42cb2f8 100644 (file)
@@ -5,10 +5,9 @@
 -- first, define the datatype.  Turn off echoing so that expected file
 -- does not depend on contents of seg.sql.
 --
+SET client_min_messages = warning;
 \set ECHO none
-psql:seg.sql:10: NOTICE:  type "seg" is not yet defined
-DETAIL:  Creating a shell type definition.
-psql:seg.sql:15: NOTICE:  argument type seg is only a shell
+RESET client_min_messages;
 --
 -- testing the input and output functions
 --
@@ -814,49 +813,49 @@ SELECT '2 .. 3'::seg >> '0 .. 1'::seg AS bool;
 
 -- "contained in" (the left value belongs within the interval specified in the right value):
 --
-SELECT '0'::seg        ~ '0'::seg AS bool;
+SELECT '0'::seg        <@ '0'::seg AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0'::seg        ~ '0 ..'::seg AS bool;
+SELECT '0'::seg        <@ '0 ..'::seg AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0'::seg        ~ '.. 0'::seg AS bool;
+SELECT '0'::seg        <@ '.. 0'::seg AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0'::seg        ~ '-1 .. 1'::seg AS bool;
+SELECT '0'::seg        <@ '-1 .. 1'::seg AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0'::seg        ~ '-1 .. 1'::seg AS bool;
+SELECT '0'::seg        <@ '-1 .. 1'::seg AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '-1'::seg       ~ '-1 .. 1'::seg AS bool;
+SELECT '-1'::seg       <@ '-1 .. 1'::seg AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '1'::seg        ~ '-1 .. 1'::seg AS bool;
+SELECT '1'::seg        <@ '-1 .. 1'::seg AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '-1 .. 1'::seg  ~ '-1 .. 1'::seg AS bool;
+SELECT '-1 .. 1'::seg  <@ '-1 .. 1'::seg AS bool;
  bool 
 ------
  t
@@ -864,43 +863,43 @@ SELECT '-1 .. 1'::seg  ~ '-1 .. 1'::seg AS bool;
 
 -- "contains" (the left value contains the interval specified in the right value):
 --
-SELECT '0'::seg @ '0'::seg AS bool;
+SELECT '0'::seg @> '0'::seg AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '0 .. '::seg ~ '0'::seg AS bool;
+SELECT '0 .. '::seg <@ '0'::seg AS bool;
  bool 
 ------
  f
 (1 row)
 
-SELECT '.. 0'::seg ~ '0'::seg AS bool;
+SELECT '.. 0'::seg <@ '0'::seg AS bool;
  bool 
 ------
  f
 (1 row)
 
-SELECT '-1 .. 1'::seg ~ '0'::seg AS bool;
+SELECT '-1 .. 1'::seg <@ '0'::seg AS bool;
  bool 
 ------
  f
 (1 row)
 
-SELECT '0'::seg ~ '-1 .. 1'::seg AS bool;
+SELECT '0'::seg <@ '-1 .. 1'::seg AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '-1'::seg ~ '-1 .. 1'::seg AS bool;
+SELECT '-1'::seg <@ '-1 .. 1'::seg AS bool;
  bool 
 ------
  t
 (1 row)
 
-SELECT '1'::seg ~ '-1 .. 1'::seg AS bool;
+SELECT '1'::seg <@ '-1 .. 1'::seg AS bool;
  bool 
 ------
  t
@@ -911,14 +910,14 @@ SELECT '1'::seg ~ '-1 .. 1'::seg AS bool;
 CREATE TABLE test_seg (s seg);
 \copy test_seg from 'data/test_seg.data'
 CREATE INDEX test_seg_ix ON test_seg USING gist (s);
-SELECT count(*) FROM test_seg WHERE s @ '11..11.3';
+SELECT count(*) FROM test_seg WHERE s @> '11..11.3';
  count 
 -------
    143
 (1 row)
 
 -- Test sorting 
-SELECT * FROM test_seg WHERE s @ '11..11.3' GROUP BY s;
+SELECT * FROM test_seg WHERE s @> '11..11.3' GROUP BY s;
         s        
 -----------------
  .. 4.0e1
index 8f0c83c298d45d644faa683bbfc27b33a9a4de7e..aea86765568685b73e9d43e0548aa4075552801d 100644 (file)
@@ -492,9 +492,11 @@ gseg_leaf_consistent(SEG * key,
            retval = (bool) seg_same(key, query);
            break;
        case RTContainsStrategyNumber:
+       case RTOldContainsStrategyNumber:
            retval = (bool) seg_contains(key, query);
            break;
        case RTContainedByStrategyNumber:
+       case RTOldContainedByStrategyNumber:
            retval = (bool) seg_contained(key, query);
            break;
        default:
@@ -533,9 +535,11 @@ gseg_internal_consistent(SEG * key,
            break;
        case RTSameStrategyNumber:
        case RTContainsStrategyNumber:
+       case RTOldContainsStrategyNumber:
            retval = (bool) seg_contains(key, query);
            break;
        case RTContainedByStrategyNumber:
+       case RTOldContainedByStrategyNumber:
            retval = (bool) seg_overlap(key, query);
            break;
        default:
index 94a02224a0e17c8743a228635aa836e30fee2546..b5e56d346296a0183683bde47a8c5aed0ad47eb2 100644 (file)
@@ -281,6 +281,25 @@ CREATE OPERATOR <> (
    JOIN = neqjoinsel
 );
 
+CREATE OPERATOR @> (
+   LEFTARG = seg,
+   RIGHTARG = seg,
+   PROCEDURE = seg_contains,
+   COMMUTATOR = '<@',
+   RESTRICT = contsel,
+   JOIN = contjoinsel
+);
+
+CREATE OPERATOR <@ (
+   LEFTARG = seg,
+   RIGHTARG = seg,
+   PROCEDURE = seg_contained,
+   COMMUTATOR = '@>',
+   RESTRICT = contsel,
+   JOIN = contjoinsel
+);
+
+-- obsolete:
 CREATE OPERATOR @ (
    LEFTARG = seg,
    RIGHTARG = seg,
@@ -357,8 +376,10 @@ AS
    OPERATOR    4   &> ,
    OPERATOR    5   >> ,
    OPERATOR    6   = ,
-   OPERATOR    7   @ ,
-   OPERATOR    8   ~ ,
+   OPERATOR    7   @> ,
+   OPERATOR    8   <@ ,
+   OPERATOR    13  @ ,
+   OPERATOR    14  ~ ,
    FUNCTION    1   gseg_consistent (internal, seg, int4),
    FUNCTION    2   gseg_union (internal, internal),
    FUNCTION    3   gseg_compress (internal),
index 95394c95d04a0935d86f024b7c4741daba0bea52..91d771db181ce11e2fe4329ec87c666f8ee8c3fa 100644 (file)
@@ -6,9 +6,11 @@
 -- first, define the datatype.  Turn off echoing so that expected file
 -- does not depend on contents of seg.sql.
 --
+SET client_min_messages = warning;
 \set ECHO none
 \i seg.sql
 \set ECHO all
+RESET client_min_messages;
 
 --
 -- testing the input and output functions
@@ -191,24 +193,24 @@ SELECT '2 .. 3'::seg >> '0 .. 1'::seg AS bool;
 
 -- "contained in" (the left value belongs within the interval specified in the right value):
 --
-SELECT '0'::seg        ~ '0'::seg AS bool;
-SELECT '0'::seg        ~ '0 ..'::seg AS bool;
-SELECT '0'::seg        ~ '.. 0'::seg AS bool;
-SELECT '0'::seg        ~ '-1 .. 1'::seg AS bool;
-SELECT '0'::seg        ~ '-1 .. 1'::seg AS bool;
-SELECT '-1'::seg       ~ '-1 .. 1'::seg AS bool;
-SELECT '1'::seg        ~ '-1 .. 1'::seg AS bool;
-SELECT '-1 .. 1'::seg  ~ '-1 .. 1'::seg AS bool;
+SELECT '0'::seg        <@ '0'::seg AS bool;
+SELECT '0'::seg        <@ '0 ..'::seg AS bool;
+SELECT '0'::seg        <@ '.. 0'::seg AS bool;
+SELECT '0'::seg        <@ '-1 .. 1'::seg AS bool;
+SELECT '0'::seg        <@ '-1 .. 1'::seg AS bool;
+SELECT '-1'::seg       <@ '-1 .. 1'::seg AS bool;
+SELECT '1'::seg        <@ '-1 .. 1'::seg AS bool;
+SELECT '-1 .. 1'::seg  <@ '-1 .. 1'::seg AS bool;
 
 -- "contains" (the left value contains the interval specified in the right value):
 --
-SELECT '0'::seg @ '0'::seg AS bool;
-SELECT '0 .. '::seg ~ '0'::seg AS bool;
-SELECT '.. 0'::seg ~ '0'::seg AS bool;
-SELECT '-1 .. 1'::seg ~ '0'::seg AS bool;
-SELECT '0'::seg ~ '-1 .. 1'::seg AS bool;
-SELECT '-1'::seg ~ '-1 .. 1'::seg AS bool;
-SELECT '1'::seg ~ '-1 .. 1'::seg AS bool;
+SELECT '0'::seg @> '0'::seg AS bool;
+SELECT '0 .. '::seg <@ '0'::seg AS bool;
+SELECT '.. 0'::seg <@ '0'::seg AS bool;
+SELECT '-1 .. 1'::seg <@ '0'::seg AS bool;
+SELECT '0'::seg <@ '-1 .. 1'::seg AS bool;
+SELECT '-1'::seg <@ '-1 .. 1'::seg AS bool;
+SELECT '1'::seg <@ '-1 .. 1'::seg AS bool;
 
 -- Load some example data and build the index
 -- 
@@ -217,7 +219,7 @@ CREATE TABLE test_seg (s seg);
 \copy test_seg from 'data/test_seg.data'
 
 CREATE INDEX test_seg_ix ON test_seg USING gist (s);
-SELECT count(*) FROM test_seg WHERE s @ '11..11.3';
+SELECT count(*) FROM test_seg WHERE s @> '11..11.3';
 
 -- Test sorting 
-SELECT * FROM test_seg WHERE s @ '11..11.3' GROUP BY s;
+SELECT * FROM test_seg WHERE s @> '11..11.3' GROUP BY s;
index 21ffdfd700f97e395bfef61a4dfa109d4c628392..ebf93e493012826ddbb0f56f1d3d655227be7496 100644 (file)
@@ -18,6 +18,10 @@ DROP FUNCTION gseg_compress(internal);
 
 DROP FUNCTION gseg_consistent(internal,seg,int4);
 
+DROP OPERATOR <@ (seg, seg);
+
+DROP OPERATOR @> (seg, seg);
+
 DROP OPERATOR ~ (seg, seg);
 
 DROP OPERATOR @ (seg, seg);
index 738ac52cd678c5d7e8a658ed094ac8464c2c6dce..926bc3ad1afbc7afc1d1e35b84dd0b92508b4533 100644 (file)
@@ -1,59 +1,45 @@
 --
 -- first, define the datatype.  Turn off echoing so that expected file
--- does not depend on contents of seg.sql.
+-- does not depend on contents of tsearch2.sql.
 --
+SET client_min_messages = warning;
 \set ECHO none
-psql:tsearch2.sql:13: NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "pg_ts_dict_pkey" for table "pg_ts_dict"
-psql:tsearch2.sql:177: NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "pg_ts_parser_pkey" for table "pg_ts_parser"
-psql:tsearch2.sql:276: NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "pg_ts_cfg_pkey" for table "pg_ts_cfg"
-psql:tsearch2.sql:283: NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "pg_ts_cfgmap_pkey" for table "pg_ts_cfgmap"
-psql:tsearch2.sql:389: NOTICE:  type "tsvector" is not yet defined
-DETAIL:  Creating a shell type definition.
-psql:tsearch2.sql:394: NOTICE:  argument type tsvector is only a shell
-psql:tsearch2.sql:448: NOTICE:  type "tsquery" is not yet defined
-DETAIL:  Creating a shell type definition.
-psql:tsearch2.sql:453: NOTICE:  argument type tsquery is only a shell
-psql:tsearch2.sql:611: NOTICE:  type "gtsvector" is not yet defined
-DETAIL:  Creating a shell type definition.
-psql:tsearch2.sql:616: NOTICE:  argument type gtsvector is only a shell
-psql:tsearch2.sql:1106: NOTICE:  type "gtsq" is not yet defined
-DETAIL:  Creating a shell type definition.
-psql:tsearch2.sql:1111: NOTICE:  argument type gtsq is only a shell
+RESET client_min_messages;
 --tsvector
 SELECT '1'::tsvector;
  tsvector 
 ----------
- '1'     
+ '1'
 (1 row)
 
 SELECT '1 '::tsvector;
  tsvector 
 ----------
- '1'     
+ '1'
 (1 row)
 
 SELECT ' 1'::tsvector;
  tsvector 
 ----------
- '1'     
+ '1'
 (1 row)
 
 SELECT ' 1 '::tsvector;
  tsvector 
 ----------
- '1'     
+ '1'
 (1 row)
 
 SELECT '1 2'::tsvector;
  tsvector 
 ----------
- '1' '2' 
+ '1' '2'
 (1 row)
 
 SELECT '''1 2'''::tsvector;
  tsvector 
 ----------
- '1 2'   
+ '1 2'
 (1 row)
 
 SELECT E'''1 \\''2'''::tsvector;
@@ -108,31 +94,31 @@ select strip('w:12B w:13* w:12,5,6 a:1,3* a:3 w asd:1dc asd'::tsvector);
 SELECT '1'::tsquery;
  tsquery 
 ---------
- '1'    
+ '1'
 (1 row)
 
 SELECT '1 '::tsquery;
  tsquery 
 ---------
- '1'    
+ '1'
 (1 row)
 
 SELECT ' 1'::tsquery;
  tsquery 
 ---------
- '1'    
+ '1'
 (1 row)
 
 SELECT ' 1 '::tsquery;
  tsquery 
 ---------
- '1'    
+ '1'
 (1 row)
 
 SELECT '''1 2'''::tsquery;
  tsquery 
 ---------
- '1 2'  
+ '1 2'
 (1 row)
 
 SELECT E'''1 \\''2'''::tsquery;
@@ -144,7 +130,7 @@ SELECT E'''1 \\''2'''::tsquery;
 SELECT '!1'::tsquery;
  tsquery 
 ---------
- !'1'   
+ !'1'
 (1 row)
 
 SELECT '1|2'::tsquery;
@@ -348,31 +334,31 @@ SELECT '''the wether'':dc & '' sKies '':BC & a:d b:a';
 select 'a' < 'b & c'::tsquery;
  ?column? 
 ----------
- t       
+ t
 (1 row)
 
 select 'a' > 'b & c'::tsquery;
  ?column? 
 ----------
- f       
+ f
 (1 row)
 
 select 'a | f' < 'b & c'::tsquery;
  ?column? 
 ----------
- t       
+ t
 (1 row)
 
 select 'a | ff' < 'b & c'::tsquery;
  ?column? 
 ----------
- f       
+ f
 (1 row)
 
 select 'a | f | g' < 'b & c'::tsquery;
  ?column? 
 ----------
- f       
+ f
 (1 row)
 
 select numnode( 'new'::tsquery );
@@ -504,60 +490,60 @@ select rewrite( ARRAY['bar &  new & qq & foo & york', keyword, sample] ) from te
  'citi' & 'foo' & ( 'qq' | 'bar' ) & ( 'nyc' | ( 'appl' & 'big' | 'york' & 'new' ) )
 (1 row)
 
-select keyword from test_tsquery where keyword @ 'new';
+select keyword from test_tsquery where keyword @> 'new';
     keyword     
 ----------------
  'new' & 'york'
 (1 row)
 
-select keyword from test_tsquery where keyword @ 'moscow';
+select keyword from test_tsquery where keyword @> 'moscow';
  keyword  
 ----------
  'moscow'
 (1 row)
 
-select keyword from test_tsquery where keyword ~ 'new';
+select keyword from test_tsquery where keyword <@ 'new';
  keyword 
 ---------
 (0 rows)
 
-select keyword from test_tsquery where keyword ~ 'moscow';
+select keyword from test_tsquery where keyword <@ 'moscow';
  keyword  
 ----------
  'moscow'
 (1 row)
 
-select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'moscow') as query where keyword ~ query;
+select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'moscow') as query where keyword <@ query;
        rewrite       
 ---------------------
  'moskva' | 'moscow'
 (1 row)
 
-select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'moscow & hotel') as query where keyword ~ query;
+select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'moscow & hotel') as query where keyword <@ query;
               rewrite              
 -----------------------------------
  ( 'moskva' | 'moscow' ) & 'hotel'
 (1 row)
 
-select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'bar &  new & qq & foo & york') as query where keyword ~ query;
+select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'bar &  new & qq & foo & york') as query where keyword <@ query;
                                        rewrite                                       
 -------------------------------------------------------------------------------------
  'citi' & 'foo' & ( 'qq' | 'bar' ) & ( 'nyc' | ( 'appl' & 'big' | 'york' & 'new' ) )
 (1 row)
 
-select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'moscow') as query where query @ keyword;
+select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'moscow') as query where query @> keyword;
        rewrite       
 ---------------------
  'moskva' | 'moscow'
 (1 row)
 
-select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'moscow & hotel') as query where query @ keyword;
+select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'moscow & hotel') as query where query @> keyword;
               rewrite              
 -----------------------------------
  ( 'moskva' | 'moscow' ) & 'hotel'
 (1 row)
 
-select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'bar &  new & qq & foo & york') as query where query @ keyword;
+select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'bar &  new & qq & foo & york') as query where query @> keyword;
                                        rewrite                                       
 -------------------------------------------------------------------------------------
  'citi' & 'foo' & ( 'qq' | 'bar' ) & ( 'nyc' | ( 'appl' & 'big' | 'york' & 'new' ) )
@@ -565,60 +551,60 @@ select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('d
 
 create index qq on test_tsquery using gist (keyword gist_tp_tsquery_ops);
 set enable_seqscan='off';
-select keyword from test_tsquery where keyword @ 'new';
+select keyword from test_tsquery where keyword @> 'new';
     keyword     
 ----------------
  'new' & 'york'
 (1 row)
 
-select keyword from test_tsquery where keyword @ 'moscow';
+select keyword from test_tsquery where keyword @> 'moscow';
  keyword  
 ----------
  'moscow'
 (1 row)
 
-select keyword from test_tsquery where keyword ~ 'new';
+select keyword from test_tsquery where keyword <@ 'new';
  keyword 
 ---------
 (0 rows)
 
-select keyword from test_tsquery where keyword ~ 'moscow';
+select keyword from test_tsquery where keyword <@ 'moscow';
  keyword  
 ----------
  'moscow'
 (1 row)
 
-select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'moscow') as query where keyword ~ query;
+select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'moscow') as query where keyword <@ query;
        rewrite       
 ---------------------
  'moskva' | 'moscow'
 (1 row)
 
-select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'moscow & hotel') as query where keyword ~ query;
+select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'moscow & hotel') as query where keyword <@ query;
               rewrite              
 -----------------------------------
  ( 'moskva' | 'moscow' ) & 'hotel'
 (1 row)
 
-select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'bar &  new & qq & foo & york') as query where keyword ~ query;
+select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'bar &  new & qq & foo & york') as query where keyword <@ query;
                                        rewrite                                       
 -------------------------------------------------------------------------------------
  'citi' & 'foo' & ( 'qq' | 'bar' ) & ( 'nyc' | ( 'appl' & 'big' | 'york' & 'new' ) )
 (1 row)
 
-select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'moscow') as query where query @ keyword;
+select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'moscow') as query where query @> keyword;
        rewrite       
 ---------------------
  'moskva' | 'moscow'
 (1 row)
 
-select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'moscow & hotel') as query where query @ keyword;
+select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'moscow & hotel') as query where query @> keyword;
               rewrite              
 -----------------------------------
  ( 'moskva' | 'moscow' ) & 'hotel'
 (1 row)
 
-select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'bar &  new & qq & foo & york') as query where query @ keyword;
+select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'bar &  new & qq & foo & york') as query where query @> keyword;
                                        rewrite                                       
 -------------------------------------------------------------------------------------
  'citi' & 'foo' & ( 'qq' | 'bar' ) & ( 'nyc' | ( 'appl' & 'big' | 'york' & 'new' ) )
@@ -640,29 +626,29 @@ select lexize('en_stem', 'SKIES Problems identity');
 select * from token_type('default');
  tokid |    alias     |               descr               
 -------+--------------+-----------------------------------
-     1 | lword        | Latin word                       
-     2 | nlword       | Non-latin word                   
-     3 | word         | Word                             
-     4 | email        | Email                            
-     5 | url          | URL                              
-     6 | host         | Host                             
-     7 | sfloat       | Scientific notation              
-     8 | version      | VERSION                          
-     9 | part_hword   | Part of hyphenated word          
+     1 | lword        | Latin word
+     2 | nlword       | Non-latin word
+     3 | word         | Word
+     4 | email        | Email
+     5 | url          | URL
+     6 | host         | Host
+     7 | sfloat       | Scientific notation
+     8 | version      | VERSION
+     9 | part_hword   | Part of hyphenated word
     10 | nlpart_hword | Non-latin part of hyphenated word
-    11 | lpart_hword  | Latin part of hyphenated word    
-    12 | blank        | Space symbols                    
-    13 | tag          | HTML Tag                         
-    14 | protocol     | Protocol head                    
-    15 | hword        | Hyphenated word                  
-    16 | lhword       | Latin hyphenated word            
-    17 | nlhword      | Non-latin hyphenated word        
-    18 | uri          | URI                              
-    19 | file         | File or path name                
-    20 | float        | Decimal notation                 
-    21 | int          | Signed integer                   
-    22 | uint         | Unsigned integer                 
-    23 | entity       | HTML Entity                      
+    11 | lpart_hword  | Latin part of hyphenated word
+    12 | blank        | Space symbols
+    13 | tag          | HTML Tag
+    14 | protocol     | Protocol head
+    15 | hword        | Hyphenated word
+    16 | lhword       | Latin hyphenated word
+    17 | nlhword      | Non-latin hyphenated word
+    18 | uri          | URI
+    19 | file         | File or path name
+    20 | float        | Decimal notation
+    21 | int          | Signed integer
+    22 | uint         | Unsigned integer
+    23 | entity       | HTML Entity
 (23 rows)
 
 select * from parse('default', '345 [email protected] '' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/?  ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 [email protected] qwe-wer asdf qwer jf sdjk ewr1> ewri2 ">
@@ -670,143 +656,143 @@ select * from parse('default', '345 [email protected] '' http://www.com/ http://aew.werc
  wow  < jqw <> qwerty');
  tokid |                token                 
 -------+--------------------------------------
-    22 | 345                                 
-    12 |                                     
-     1 | qwe                                 
-    12 | @                                   
-    19 | efd.r                               
-    12 |  '                                  
-    14 | http://                             
-     6 | www.com                             
-    12 | /                                   
-    14 | http://                             
-     5 | aew.werc.ewr/?ad=qwe&dw             
-     6 | aew.werc.ewr                        
-    18 | /?ad=qwe&dw                         
-    12 |                                     
-     5 | 1aew.werc.ewr/?ad=qwe&dw            
-     6 | 1aew.werc.ewr                       
-    18 | /?ad=qwe&dw                         
-    12 |                                     
-     6 | 2aew.werc.ewr                       
-    12 |                                     
-    14 | http://                             
-     5 | 3aew.werc.ewr/?ad=qwe&dw            
-     6 | 3aew.werc.ewr                       
-    18 | /?ad=qwe&dw                         
-    12 |                                     
-    14 | http://                             
-     6 | 4aew.werc.ewr                       
-    12 |                                     
-    14 | http://                             
-     6 | 5aew.werc.ewr:8100                  
-    12 | /?                                  
-     1 | ad                                  
-    12 | =                                   
-     1 | qwe                                 
-    12 | &                                   
-     1 | dw                                  
-    12 |                                     
-     5 | 6aew.werc.ewr:8100/?ad=qwe&dw       
-     6 | 6aew.werc.ewr:8100                  
-    18 | /?ad=qwe&dw                         
-    12 |                                     
+    22 | 345
+    12 |  
+     1 | qwe
+    12 | @
+    19 | efd.r
+    12 |  ' 
+    14 | http://
+     6 | www.com
+    12 | / 
+    14 | http://
+     5 | aew.werc.ewr/?ad=qwe&dw
+     6 | aew.werc.ewr
+    18 | /?ad=qwe&dw
+    12 |  
+     5 | 1aew.werc.ewr/?ad=qwe&dw
+     6 | 1aew.werc.ewr
+    18 | /?ad=qwe&dw
+    12 |  
+     6 | 2aew.werc.ewr
+    12 |  
+    14 | http://
+     5 | 3aew.werc.ewr/?ad=qwe&dw
+     6 | 3aew.werc.ewr
+    18 | /?ad=qwe&dw
+    12 |  
+    14 | http://
+     6 | 4aew.werc.ewr
+    12 |  
+    14 | http://
+     6 | 5aew.werc.ewr:8100
+    12 | /?  
+     1 | ad
+    12 | =
+     1 | qwe
+    12 | &
+     1 | dw
+    12 |  
+     5 | 6aew.werc.ewr:8100/?ad=qwe&dw
+     6 | 6aew.werc.ewr:8100
+    18 | /?ad=qwe&dw
+    12 |  
      5 | 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32
-     6 | 7aew.werc.ewr:8100                  
-    18 | /?ad=qwe&dw=%20%32                  
-    12 |                                     
-     7 | +4.0e-10                            
-    12 |                                     
-     1 | qwe                                 
-    12 |                                     
-     1 | qwe                                 
-    12 |                                     
-     1 | qwqwe                               
-    12 |                                     
-    20 | 234.435                             
-    12 |                                     
-    22 | 455                                 
-    12 |                                     
-    20 | 5.005                               
-    12 |                                     
-     4 | [email protected]                    
-    12 |                                     
-    16 | qwe-wer                             
-    11 | qwe                                 
-    12 | -                                   
-    11 | wer                                 
-    12 |                                     
-     1 | asdf                                
-    12 |                                     
-    13 |                                 
-     1 | qwer                                
-    12 |                                     
-     1 | jf                                  
-    12 |                                     
-     1 | sdjk                                
-    12 | <                                   
-     1 | we                                  
-    12 |                                     
-     1 | hjwer                               
-    12 |                                     
-    13 |                             
-    12 |                                     
-     3 | ewr1                                
-    12 | >                                   
-     3 | ewri2                               
-    12 |                                     
-    13 | ">                 
-    12 |                                     
-       :                                     
-    19 | /usr/local/fff                      
-    12 |                                     
-    19 | /awdf/dwqe/4325                     
-    12 |                                     
-    19 | rewt/ewr                            
-    12 |                                     
-     1 | wefjn                               
-    12 |                                     
-    19 | /wqe-324/ewr                        
-    12 |                                     
-    19 | gist.h                              
-    12 |                                     
-    19 | gist.h.c                            
-    12 |                                     
-    19 | gist.c                              
-    12 | .                                   
-     1 | readline                            
-    12 |                                     
-    20 | 4.2                                 
-    12 |                                     
-    20 | 4.2                                 
-    12 | .                                   
-    20 | 4.2                                 
-    12 | ,                                   
-    15 | readline-4.2                        
-    11 | readline                            
-    12 | -                                   
-    20 | 4.2                                 
-    12 |                                     
-    15 | readline-4.2                        
-    11 | readline                            
-    12 | -                                   
-    20 | 4.2                                 
-    12 | .                                   
-    22 | 234                                 
-    12 |                                     
-       :                                     
-    12 | <                                   
-     1 | i                                   
-    12 |                                     
-    13 |                                  
-    12 |                                     
-     1 | wow                                 
-    12 |                                     
-    12 | <                                   
-     1 | jqw                                 
-    12 |                                     
-    12 | <>                                  
-     1 | qwerty                              
+     6 | 7aew.werc.ewr:8100
+    18 | /?ad=qwe&dw=%20%32
+    12 |  
+     7 | +4.0e-10
+    12 |  
+     1 | qwe
+    12 |  
+     1 | qwe
+    12 |  
+     1 | qwqwe
+    12 |  
+    20 | 234.435
+    12 |  
+    22 | 455
+    12 |  
+    20 | 5.005
+    12 |  
+     4 | [email protected]
+    12 |  
+    16 | qwe-wer
+    11 | qwe
+    12 | -
+    11 | wer
+    12 |  
+     1 | asdf
+    12 |  
+    13 | 
+     1 | qwer
+    12 |  
+     1 | jf
+    12 |  
+     1 | sdjk
+    12 | <
+     1 | we
+    12 |  
+     1 | hjwer
+    12 |  
+    13 | 
+    12 |  
+     3 | ewr1
+    12 | > 
+     3 | ewri2
+    12 |  
+    13 | ">
+    12 | 
+       : 
+    19 | /usr/local/fff
+    12 |  
+    19 | /awdf/dwqe/4325
+    12 |  
+    19 | rewt/ewr
+    12 |  
+     1 | wefjn
+    12 |  
+    19 | /wqe-324/ewr
+    12 |  
+    19 | gist.h
+    12 |  
+    19 | gist.h.c
+    12 |  
+    19 | gist.c
+    12 | . 
+     1 | readline
+    12 |  
+    20 | 4.2
+    12 |  
+    20 | 4.2
+    12 | . 
+    20 | 4.2
+    12 | , 
+    15 | readline-4.2
+    11 | readline
+    12 | -
+    20 | 4.2
+    12 |  
+    15 | readline-4.2
+    11 | readline
+    12 | -
+    20 | 4.2
+    12 | . 
+    22 | 234
+    12 |  
+       : 
+    12 | <
+     1 | i
+    12 |  
+    13 | 
+    12 |  
+     1 | wow
+    12 |   
+    12 | < 
+     1 | jqw
+    12 |  
+    12 | <> 
+     1 | qwerty
 (135 rows)
 
 SELECT to_tsvector('default', '345 [email protected] '' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/?  ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 [email protected] qwe-wer asdf qwer jf sdjk ewr1> ewri2 ">
@@ -906,31 +892,31 @@ select plainto_tsquery('default', 'foo bar') && 'asd | fg';
 select 'a b:89  ca:23A,64b d:34c'::tsvector @@ 'd:AC & ca';
  ?column? 
 ----------
- t       
+ t
 (1 row)
 
 select 'a b:89  ca:23A,64b d:34c'::tsvector @@ 'd:AC & ca:B';
  ?column? 
 ----------
- t       
+ t
 (1 row)
 
 select 'a b:89  ca:23A,64b d:34c'::tsvector @@ 'd:AC & ca:A';
  ?column? 
 ----------
- t       
+ t
 (1 row)
 
 select 'a b:89  ca:23A,64b d:34c'::tsvector @@ 'd:AC & ca:C';
  ?column? 
 ----------
- f       
+ f
 (1 row)
 
 select 'a b:89  ca:23A,64b d:34c'::tsvector @@ 'd:AC & ca:CB';
  ?column? 
 ----------
- t       
+ t
 (1 row)
 
 CREATE TABLE test_tsvector( t text, a tsvector );
@@ -1012,7 +998,7 @@ SELECT count(*) FROM test_tsvector WHERE a @@ '(eq|yt)&(wr|qh)';
 select set_curcfg('default');
  set_curcfg 
 ------------
-           
 (1 row)
 
 CREATE TRIGGER tsvectorupdate
@@ -2297,7 +2283,7 @@ select reset_tsearch();
 NOTICE:  TSearch cache cleaned
  reset_tsearch 
 ---------------
-              
 (1 row)
 
 select to_tsquery('default', 'skies & books');
@@ -2402,8 +2388,8 @@ Upon a woman s face. E.  J.  Pratt  (1882 1964)
                   headline                  
 --------------------------------------------
  sea a thousand years,
- A thousand years to trace   
- The granite features of this cliff        
+ A thousand years to trace
+ The granite features of this cliff
 (1 row)
 
  
@@ -2418,8 +2404,8 @@ Upon a woman s face. E.  J.  Pratt  (1882 1964)
 ', to_tsquery('granite&sea'));
                  headline                  
 -------------------------------------------
sea a thousand years,             
- A thousand years to trace                
sea a thousand years,
+ A thousand years to trace
  The granite features of this cliff
 (1 row)
 
@@ -2435,8 +2421,8 @@ Upon a woman s face. E.  J.  Pratt  (1882 1964)
 ', to_tsquery('sea'));
               headline              
 ------------------------------------
sea a thousand years,      
- A thousand years to trace         
sea a thousand years,
+ A thousand years to trace
  The granite features of this cliff
 (1 row)
 
@@ -2455,29 +2441,29 @@ ff-bg
 to_tsquery('sea&foo'), 'HighlightAll=true');
                                   headline                                   
 -----------------------------------------------------------------------------
-                                                                            
                                                                     
                                                      
                                                                     
Sea view wow foo bar qq                        
Sea view wow foo bar qq
  YES  
-  ff-bg                                                                     
                                                                  
                                                                    
                                                                    
+  ff-bg
 (1 row)
 
 --check debug
 select * from ts_debug('Tsearch module for PostgreSQL 7.3.3');
  ts_name | tok_type | description |   token    | dict_name |   tsvector   
 ---------+----------+-------------+------------+-----------+--------------
- default | lword    | Latin word  | Tsearch    | {en_stem} | 'tsearch'   
- default | lword    | Latin word  | module     | {en_stem} | 'modul'     
- default | lword    | Latin word  | for        | {en_stem} |             
+ default | lword    | Latin word  | Tsearch    | {en_stem} | 'tsearch'
+ default | lword    | Latin word  | module     | {en_stem} | 'modul'
+ default | lword    | Latin word  | for        | {en_stem} | 
  default | lword    | Latin word  | PostgreSQL | {en_stem} | 'postgresql'
- default | version  | VERSION     | 7.3.3      | {simple}  | '7.3.3'     
+ default | version  | VERSION     | 7.3.3      | {simple}  | '7.3.3'
 (5 rows)
 
 --check ordering
@@ -2485,520 +2471,520 @@ insert into test_tsvector values (null, null);
 select a is null, a from test_tsvector order by a;
  ?column? |                                                                                                                                                                                                                                                                              a                                                                                                                                                                                                                                                                              
 ----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- f        |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
- f        |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
- f        |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
- f        |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
- f        |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
- f        |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
- f        |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
- f        |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
- f        |                                                                                                                                                                                                                                                                                                                                                                                                                                                  &nbs