1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Rename contrib contains/contained-by operators to @> and <@, per discussion.

This commit is contained in:
Tom Lane
2006-09-10 17:36:52 +00:00
parent ba920e1c91
commit 684ad6a92f
36 changed files with 1290 additions and 1111 deletions

View 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.

View 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:

View 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),

View 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

View 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

View 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

View 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
--

View 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);