From 684ad6a92fcc33adebdab65c4e7d72a68ba05408 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 10 Sep 2006 17:36:52 +0000 Subject: Rename contrib contains/contained-by operators to @> and <@, per discussion. --- contrib/cube/README.cube | 10 +++++-- contrib/cube/cube.c | 6 +++- contrib/cube/cube.sql.in | 19 +++++++++++-- contrib/cube/expected/cube.out | 60 ++++++++++++++++++++-------------------- contrib/cube/expected/cube_1.out | 60 ++++++++++++++++++++-------------------- contrib/cube/expected/cube_2.out | 60 ++++++++++++++++++++-------------------- contrib/cube/sql/cube.sql | 60 ++++++++++++++++++++-------------------- contrib/cube/uninstall_cube.sql | 4 +++ 8 files changed, 154 insertions(+), 125 deletions(-) (limited to 'contrib/cube') diff --git a/contrib/cube/README.cube b/contrib/cube/README.cube index bc28c6ec31..e83763f68e 100644 --- a/contrib/cube/README.cube +++ b/contrib/cube/README.cube @@ -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. diff --git a/contrib/cube/cube.c b/contrib/cube/cube.c index a4472ee20e..16ba5340fb 100644 --- a/contrib/cube/cube.c +++ b/contrib/cube/cube.c @@ -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: diff --git a/contrib/cube/cube.sql.in b/contrib/cube/cube.sql.in index 3405c8e1f9..c1697b0ea9 100644 --- a/contrib/cube/cube.sql.in +++ b/contrib/cube/cube.sql.in @@ -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), diff --git a/contrib/cube/expected/cube.out b/contrib/cube/expected/cube.out index 59d5114861..4f643573b5 100644 --- a/contrib/cube/expected/cube.out +++ b/contrib/cube/expected/cube.out @@ -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 diff --git a/contrib/cube/expected/cube_1.out b/contrib/cube/expected/cube_1.out index a7a8d8d64f..49e6c3fa31 100644 --- a/contrib/cube/expected/cube_1.out +++ b/contrib/cube/expected/cube_1.out @@ -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 diff --git a/contrib/cube/expected/cube_2.out b/contrib/cube/expected/cube_2.out index 0c1aba4972..ff6dbc4e5c 100644 --- a/contrib/cube/expected/cube_2.out +++ b/contrib/cube/expected/cube_2.out @@ -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 diff --git a/contrib/cube/sql/cube.sql b/contrib/cube/sql/cube.sql index 2c0e814d80..49d9869c53 100644 --- a/contrib/cube/sql/cube.sql +++ b/contrib/cube/sql/cube.sql @@ -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 -- diff --git a/contrib/cube/uninstall_cube.sql b/contrib/cube/uninstall_cube.sql index 6548a78470..784138acd5 100644 --- a/contrib/cube/uninstall_cube.sql +++ b/contrib/cube/uninstall_cube.sql @@ -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); -- cgit v1.2.1