mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-02-17 19:30:00 +08:00
Remove the << >> &< and &> operators for contrib/cube, which were
wrong, but nobody noticed because they were also useless.
This commit is contained in:
parent
54c80a3434
commit
dcf2e1c8c7
@ -181,7 +181,7 @@ numbers with more than about 16 significant digits will be truncated.
|
||||
USAGE
|
||||
=====
|
||||
|
||||
The access method for CUBE is a GiST (gist_cube_ops), which is a
|
||||
The access method for CUBE is a GiST index (gist_cube_ops), which is a
|
||||
generalization of R-tree. GiSTs allow the postgres implementation of
|
||||
R-tree, originally encoded to support 2-D geometric types such as
|
||||
boxes and polygons, to be used with any data type whose data domain
|
||||
@ -193,42 +193,21 @@ things, all geometric data types, regardless of their dimensionality
|
||||
|
||||
The operators supported by the GiST access method include:
|
||||
|
||||
a = b Same as
|
||||
|
||||
[a, b] << [c, d] Is left of
|
||||
The cubements a and b are identical.
|
||||
|
||||
The left operand, [a, b], occurs entirely to the left of the
|
||||
right operand, [c, d], on the axis (-inf, inf). It means,
|
||||
[a, b] << [c, d] is true if b < c and false otherwise
|
||||
a && b Overlaps
|
||||
|
||||
[a, b] >> [c, d] Is right of
|
||||
The cubements a and b overlap.
|
||||
|
||||
[a, b] is occurs entirely to the right of [c, d].
|
||||
[a, b] >> [c, d] is true if b > c and false otherwise
|
||||
a @ b Contains
|
||||
|
||||
[a, b] &< [c, d] Over left
|
||||
The cubement a contains the cubement b.
|
||||
|
||||
The cubement [a, b] overlaps the cubement [c, d] in such a way
|
||||
that a <= c <= b and b <= d
|
||||
a ~ b Contained in
|
||||
|
||||
[a, b] &> [c, d] Over right
|
||||
|
||||
The cubement [a, b] overlaps the cubement [c, d] in such a way
|
||||
that a > c and b <= c <= d
|
||||
|
||||
[a, b] = [c, d] Same as
|
||||
|
||||
The cubements [a, b] and [c, d] are identical, that is, a == b
|
||||
and c == d
|
||||
|
||||
[a, b] @ [c, d] Contains
|
||||
|
||||
The cubement [a, b] contains the cubement [c, d], that is,
|
||||
a <= c and b >= d
|
||||
|
||||
[a, b] @ [c, d] Contained in
|
||||
|
||||
The cubement [a, b] is contained in [c, d], that is,
|
||||
a >= c and b <= d
|
||||
The cubement a is contained in b.
|
||||
|
||||
Although the mnemonics of the following operators is questionable, I
|
||||
preserved them to maintain visual consistency with other geometric
|
||||
|
@ -72,14 +72,6 @@ NDBOX *cube_inter(NDBOX * a, NDBOX * b);
|
||||
double *cube_size(NDBOX * a);
|
||||
void rt_cube_size(NDBOX * a, double *sz);
|
||||
|
||||
/*
|
||||
** These make no sense for this type, but R-tree wants them
|
||||
*/
|
||||
bool cube_over_left(NDBOX * a, NDBOX * b);
|
||||
bool cube_over_right(NDBOX * a, NDBOX * b);
|
||||
bool cube_left(NDBOX * a, NDBOX * b);
|
||||
bool cube_right(NDBOX * a, NDBOX * b);
|
||||
|
||||
/*
|
||||
** miscellaneous
|
||||
*/
|
||||
@ -460,21 +452,9 @@ g_cube_leaf_consistent(NDBOX * key,
|
||||
*/
|
||||
switch (strategy)
|
||||
{
|
||||
case RTLeftStrategyNumber:
|
||||
retval = (bool) cube_left(key, query);
|
||||
break;
|
||||
case RTOverLeftStrategyNumber:
|
||||
retval = (bool) cube_over_left(key, query);
|
||||
break;
|
||||
case RTOverlapStrategyNumber:
|
||||
retval = (bool) cube_overlap(key, query);
|
||||
break;
|
||||
case RTOverRightStrategyNumber:
|
||||
retval = (bool) cube_over_right(key, query);
|
||||
break;
|
||||
case RTRightStrategyNumber:
|
||||
retval = (bool) cube_right(key, query);
|
||||
break;
|
||||
case RTSameStrategyNumber:
|
||||
retval = (bool) cube_eq(key, query);
|
||||
break;
|
||||
@ -502,17 +482,9 @@ g_cube_internal_consistent(NDBOX * key,
|
||||
*/
|
||||
switch (strategy)
|
||||
{
|
||||
case RTLeftStrategyNumber:
|
||||
case RTOverLeftStrategyNumber:
|
||||
retval = (bool) cube_over_left(key, query);
|
||||
break;
|
||||
case RTOverlapStrategyNumber:
|
||||
retval = (bool) cube_overlap(key, query);
|
||||
break;
|
||||
case RTOverRightStrategyNumber:
|
||||
case RTRightStrategyNumber:
|
||||
retval = (bool) cube_right(key, query);
|
||||
break;
|
||||
case RTSameStrategyNumber:
|
||||
case RTContainsStrategyNumber:
|
||||
retval = (bool) cube_contains(key, query);
|
||||
@ -692,62 +664,6 @@ rt_cube_size(NDBOX * a, double *size)
|
||||
return;
|
||||
}
|
||||
|
||||
/* The following four methods compare the projections of the boxes
|
||||
onto the 0-th coordinate axis. These methods are useless for dimensions
|
||||
larger than 2, but it seems that R-tree requires all its strategies
|
||||
map to real functions that return something */
|
||||
|
||||
/* is the right edge of (a) located to the left of
|
||||
the right edge of (b)? */
|
||||
bool
|
||||
cube_over_left(NDBOX * a, NDBOX * b)
|
||||
{
|
||||
if ((a == NULL) || (b == NULL))
|
||||
return (FALSE);
|
||||
|
||||
return (Min(a->x[a->dim - 1], a->x[2 * a->dim - 1]) <=
|
||||
Min(b->x[b->dim - 1], b->x[2 * b->dim - 1]) &&
|
||||
!cube_left(a, b) && !cube_right(a, b));
|
||||
}
|
||||
|
||||
/* is the left edge of (a) located to the right of
|
||||
the left edge of (b)? */
|
||||
bool
|
||||
cube_over_right(NDBOX * a, NDBOX * b)
|
||||
{
|
||||
if ((a == NULL) || (b == NULL))
|
||||
return (FALSE);
|
||||
|
||||
return (Min(a->x[a->dim - 1], a->x[2 * a->dim - 1]) >=
|
||||
Min(b->x[b->dim - 1], b->x[2 * b->dim - 1]) &&
|
||||
!cube_left(a, b) && !cube_right(a, b));
|
||||
}
|
||||
|
||||
|
||||
/* return 'true' if the projection of 'a' is
|
||||
entirely on the left of the projection of 'b' */
|
||||
bool
|
||||
cube_left(NDBOX * a, NDBOX * b)
|
||||
{
|
||||
if ((a == NULL) || (b == NULL))
|
||||
return (FALSE);
|
||||
|
||||
return (Min(a->x[a->dim - 1], a->x[2 * a->dim - 1]) <
|
||||
Min(b->x[0], b->x[b->dim]));
|
||||
}
|
||||
|
||||
/* return 'true' if the projection of 'a' is
|
||||
entirely on the right of the projection of 'b' */
|
||||
bool
|
||||
cube_right(NDBOX * a, NDBOX * b)
|
||||
{
|
||||
if ((a == NULL) || (b == NULL))
|
||||
return (FALSE);
|
||||
|
||||
return (Min(a->x[0], a->x[a->dim]) >
|
||||
Min(b->x[b->dim - 1], b->x[2 * b->dim - 1]));
|
||||
}
|
||||
|
||||
/* make up a metric in which one box will be 'lower' than the other
|
||||
-- this can be useful for sorting and to determine uniqueness */
|
||||
int32
|
||||
|
@ -12,12 +12,13 @@ LANGUAGE 'C' IMMUTABLE STRICT;
|
||||
CREATE OR REPLACE FUNCTION cube_out(cube)
|
||||
RETURNS cstring
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE 'c'IMMUTABLE STRICT;
|
||||
LANGUAGE 'C' IMMUTABLE STRICT;
|
||||
|
||||
CREATE TYPE cube (
|
||||
INTERNALLENGTH = variable,
|
||||
INPUT = cube_in,
|
||||
OUTPUT = cube_out
|
||||
OUTPUT = cube_out,
|
||||
ALIGNMENT = double
|
||||
);
|
||||
|
||||
COMMENT ON TYPE cube IS 'multi-dimensional cube ''(FLOAT-1, FLOAT-2, ..., FLOAT-N), (FLOAT-1, FLOAT-2, ..., FLOAT-N)''';
|
||||
@ -36,38 +37,6 @@ CREATE CAST (text AS cube) WITH FUNCTION cube(text) AS ASSIGNMENT;
|
||||
-- External C-functions for R-tree methods
|
||||
--
|
||||
|
||||
-- Left/Right methods
|
||||
|
||||
CREATE OR REPLACE FUNCTION cube_over_left(cube, cube)
|
||||
RETURNS bool
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE 'C' IMMUTABLE STRICT;
|
||||
|
||||
COMMENT ON FUNCTION cube_over_left(cube, cube) IS 'is over and left of (NOT IMPLEMENTED)';
|
||||
|
||||
CREATE OR REPLACE FUNCTION cube_over_right(cube, cube)
|
||||
RETURNS bool
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE 'C' IMMUTABLE STRICT;
|
||||
|
||||
COMMENT ON FUNCTION cube_over_right(cube, cube) IS 'is over and right of (NOT IMPLEMENTED)';
|
||||
|
||||
CREATE OR REPLACE FUNCTION cube_left(cube, cube)
|
||||
RETURNS bool
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE 'C' IMMUTABLE STRICT;
|
||||
|
||||
COMMENT ON FUNCTION cube_left(cube, cube) IS
|
||||
'is left of (NOT IMPLEMENTED)';
|
||||
|
||||
CREATE OR REPLACE FUNCTION cube_right(cube, cube)
|
||||
RETURNS bool
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE 'C' IMMUTABLE STRICT;
|
||||
|
||||
COMMENT ON FUNCTION cube_right(cube, cube) IS 'is right of (NOT IMPLEMENTED)';
|
||||
|
||||
|
||||
-- Comparison methods
|
||||
|
||||
CREATE OR REPLACE FUNCTION cube_eq(cube, cube)
|
||||
@ -242,34 +211,10 @@ CREATE OPERATOR >= (
|
||||
RESTRICT = scalargtsel, JOIN = scalargtjoinsel
|
||||
);
|
||||
|
||||
CREATE OPERATOR << (
|
||||
LEFTARG = cube, RIGHTARG = cube, PROCEDURE = cube_left,
|
||||
COMMUTATOR = '>>',
|
||||
RESTRICT = positionsel, JOIN = positionjoinsel
|
||||
);
|
||||
|
||||
CREATE OPERATOR &< (
|
||||
LEFTARG = cube, RIGHTARG = cube, PROCEDURE = cube_over_left,
|
||||
COMMUTATOR = '&>',
|
||||
RESTRICT = positionsel, JOIN = positionjoinsel
|
||||
);
|
||||
|
||||
CREATE OPERATOR && (
|
||||
LEFTARG = cube, RIGHTARG = cube, PROCEDURE = cube_overlap,
|
||||
COMMUTATOR = '&&',
|
||||
RESTRICT = positionsel, JOIN = positionjoinsel
|
||||
);
|
||||
|
||||
CREATE OPERATOR &> (
|
||||
LEFTARG = cube, RIGHTARG = cube, PROCEDURE = cube_over_right,
|
||||
COMMUTATOR = '&<',
|
||||
RESTRICT = positionsel, JOIN = positionjoinsel
|
||||
);
|
||||
|
||||
CREATE OPERATOR >> (
|
||||
LEFTARG = cube, RIGHTARG = cube, PROCEDURE = cube_right,
|
||||
COMMUTATOR = '<<',
|
||||
RESTRICT = positionsel, JOIN = positionjoinsel
|
||||
RESTRICT = areasel, JOIN = areajoinsel
|
||||
);
|
||||
|
||||
CREATE OPERATOR = (
|
||||
@ -348,11 +293,7 @@ CREATE OPERATOR CLASS cube_ops
|
||||
|
||||
CREATE OPERATOR CLASS gist_cube_ops
|
||||
DEFAULT FOR TYPE cube USING gist AS
|
||||
OPERATOR 1 << ,
|
||||
OPERATOR 2 &< ,
|
||||
OPERATOR 3 && ,
|
||||
OPERATOR 4 &> ,
|
||||
OPERATOR 5 >> ,
|
||||
OPERATOR 6 = ,
|
||||
OPERATOR 7 @ ,
|
||||
OPERATOR 8 ~ ,
|
||||
|
@ -594,254 +594,6 @@ SELECT '[(-1,-1,-1),(1,1,1)]'::cube && '[(2,1,1),(2,2,2)]'::cube AS bool;
|
||||
f
|
||||
(1 row)
|
||||
|
||||
-- "overlap on the left" / "overlap on the right"
|
||||
-- (these operators are not useful at all but R-tree seems to be
|
||||
-- sensitive to their presence)
|
||||
--
|
||||
SELECT '1'::cube &< '0'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '1'::cube &< '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '1'::cube &< '2'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube &< '0'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube &< '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube &< '(0),(0.5)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube &< '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube &< '(0),(2)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube &< '(1),(2)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube &< '(2),(3)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '0'::cube &> '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '1'::cube &> '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '2'::cube &> '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '0'::cube &> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '1'::cube &> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(0.5)' &> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube &> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(2)'::cube &> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(1),(2)'::cube &> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(2),(3)'::cube &> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
-- "left" / "right"
|
||||
-- (these operators are not useful but for 1-D or 2-D cubes, but R-tree
|
||||
-- seems to want them defined)
|
||||
--
|
||||
SELECT '1'::cube << '0'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '1'::cube << '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '1'::cube << '2'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube << '0'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube << '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube << '(0),(0.5)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube << '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube << '(0),(2)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube << '(1),(2)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube << '(2),(3)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '0'::cube >> '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '1'::cube >> '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '2'::cube >> '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '0'::cube >> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '1'::cube >> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(0.5)' >> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube >> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(2)'::cube >> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(1),(2)'::cube >> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(2),(3)'::cube >> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
-- "contained in" (the left operand is the cube entirely enclosed by
|
||||
-- the right operand):
|
||||
--
|
||||
|
@ -594,254 +594,6 @@ SELECT '[(-1,-1,-1),(1,1,1)]'::cube && '[(2,1,1),(2,2,2)]'::cube AS bool;
|
||||
f
|
||||
(1 row)
|
||||
|
||||
-- "overlap on the left" / "overlap on the right"
|
||||
-- (these operators are not useful at all but R-tree seems to be
|
||||
-- sensitive to their presence)
|
||||
--
|
||||
SELECT '1'::cube &< '0'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '1'::cube &< '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '1'::cube &< '2'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube &< '0'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube &< '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube &< '(0),(0.5)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube &< '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube &< '(0),(2)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube &< '(1),(2)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube &< '(2),(3)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '0'::cube &> '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '1'::cube &> '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '2'::cube &> '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '0'::cube &> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '1'::cube &> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(0.5)' &> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube &> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(2)'::cube &> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(1),(2)'::cube &> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(2),(3)'::cube &> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
-- "left" / "right"
|
||||
-- (these operators are not useful but for 1-D or 2-D cubes, but R-tree
|
||||
-- seems to want them defined)
|
||||
--
|
||||
SELECT '1'::cube << '0'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '1'::cube << '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '1'::cube << '2'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube << '0'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube << '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube << '(0),(0.5)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube << '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube << '(0),(2)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube << '(1),(2)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube << '(2),(3)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '0'::cube >> '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '1'::cube >> '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '2'::cube >> '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '0'::cube >> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '1'::cube >> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(0.5)' >> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube >> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(2)'::cube >> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(1),(2)'::cube >> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(2),(3)'::cube >> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
-- "contained in" (the left operand is the cube entirely enclosed by
|
||||
-- the right operand):
|
||||
--
|
||||
|
@ -594,254 +594,6 @@ SELECT '[(-1,-1,-1),(1,1,1)]'::cube && '[(2,1,1),(2,2,2)]'::cube AS bool;
|
||||
f
|
||||
(1 row)
|
||||
|
||||
-- "overlap on the left" / "overlap on the right"
|
||||
-- (these operators are not useful at all but R-tree seems to be
|
||||
-- sensitive to their presence)
|
||||
--
|
||||
SELECT '1'::cube &< '0'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '1'::cube &< '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '1'::cube &< '2'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube &< '0'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube &< '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube &< '(0),(0.5)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube &< '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube &< '(0),(2)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube &< '(1),(2)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube &< '(2),(3)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '0'::cube &> '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '1'::cube &> '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '2'::cube &> '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '0'::cube &> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '1'::cube &> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(0.5)' &> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube &> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(2)'::cube &> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(1),(2)'::cube &> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(2),(3)'::cube &> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
-- "left" / "right"
|
||||
-- (these operators are not useful but for 1-D or 2-D cubes, but R-tree
|
||||
-- seems to want them defined)
|
||||
--
|
||||
SELECT '1'::cube << '0'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '1'::cube << '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '1'::cube << '2'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube << '0'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube << '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube << '(0),(0.5)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube << '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube << '(0),(2)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube << '(1),(2)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube << '(2),(3)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '0'::cube >> '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '1'::cube >> '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '2'::cube >> '1'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '0'::cube >> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '1'::cube >> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(0.5)' >> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(1)'::cube >> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(0),(2)'::cube >> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT '(1),(2)'::cube >> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '(2),(3)'::cube >> '(0),(1)'::cube AS bool;
|
||||
bool
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
-- "contained in" (the left operand is the cube entirely enclosed by
|
||||
-- the right operand):
|
||||
--
|
||||
|
@ -164,63 +164,6 @@ SELECT '[(-1,-1,-1),(1,1,1)]'::cube && '[(1,1,1),(2,2,2)]'::cube AS bool;
|
||||
SELECT '[(-1,-1,-1),(1,1,1)]'::cube && '[(1,1),(2,2)]'::cube AS bool;
|
||||
SELECT '[(-1,-1,-1),(1,1,1)]'::cube && '[(2,1,1),(2,2,2)]'::cube AS bool;
|
||||
|
||||
-- "overlap on the left" / "overlap on the right"
|
||||
-- (these operators are not useful at all but R-tree seems to be
|
||||
-- sensitive to their presence)
|
||||
--
|
||||
SELECT '1'::cube &< '0'::cube AS bool;
|
||||
SELECT '1'::cube &< '1'::cube AS bool;
|
||||
SELECT '1'::cube &< '2'::cube AS bool;
|
||||
|
||||
SELECT '(0),(1)'::cube &< '0'::cube AS bool;
|
||||
SELECT '(0),(1)'::cube &< '1'::cube AS bool;
|
||||
SELECT '(0),(1)'::cube &< '(0),(0.5)'::cube AS bool;
|
||||
SELECT '(0),(1)'::cube &< '(0),(1)'::cube AS bool;
|
||||
SELECT '(0),(1)'::cube &< '(0),(2)'::cube AS bool;
|
||||
SELECT '(0),(1)'::cube &< '(1),(2)'::cube AS bool;
|
||||
SELECT '(0),(1)'::cube &< '(2),(3)'::cube AS bool;
|
||||
|
||||
SELECT '0'::cube &> '1'::cube AS bool;
|
||||
SELECT '1'::cube &> '1'::cube AS bool;
|
||||
SELECT '2'::cube &> '1'::cube AS bool;
|
||||
|
||||
SELECT '0'::cube &> '(0),(1)'::cube AS bool;
|
||||
SELECT '1'::cube &> '(0),(1)'::cube AS bool;
|
||||
SELECT '(0),(0.5)' &> '(0),(1)'::cube AS bool;
|
||||
SELECT '(0),(1)'::cube &> '(0),(1)'::cube AS bool;
|
||||
SELECT '(0),(2)'::cube &> '(0),(1)'::cube AS bool;
|
||||
SELECT '(1),(2)'::cube &> '(0),(1)'::cube AS bool;
|
||||
SELECT '(2),(3)'::cube &> '(0),(1)'::cube AS bool;
|
||||
|
||||
|
||||
-- "left" / "right"
|
||||
-- (these operators are not useful but for 1-D or 2-D cubes, but R-tree
|
||||
-- seems to want them defined)
|
||||
--
|
||||
SELECT '1'::cube << '0'::cube AS bool;
|
||||
SELECT '1'::cube << '1'::cube AS bool;
|
||||
SELECT '1'::cube << '2'::cube AS bool;
|
||||
|
||||
SELECT '(0),(1)'::cube << '0'::cube AS bool;
|
||||
SELECT '(0),(1)'::cube << '1'::cube AS bool;
|
||||
SELECT '(0),(1)'::cube << '(0),(0.5)'::cube AS bool;
|
||||
SELECT '(0),(1)'::cube << '(0),(1)'::cube AS bool;
|
||||
SELECT '(0),(1)'::cube << '(0),(2)'::cube AS bool;
|
||||
SELECT '(0),(1)'::cube << '(1),(2)'::cube AS bool;
|
||||
SELECT '(0),(1)'::cube << '(2),(3)'::cube AS bool;
|
||||
|
||||
SELECT '0'::cube >> '1'::cube AS bool;
|
||||
SELECT '1'::cube >> '1'::cube AS bool;
|
||||
SELECT '2'::cube >> '1'::cube AS bool;
|
||||
|
||||
SELECT '0'::cube >> '(0),(1)'::cube AS bool;
|
||||
SELECT '1'::cube >> '(0),(1)'::cube AS bool;
|
||||
SELECT '(0),(0.5)' >> '(0),(1)'::cube AS bool;
|
||||
SELECT '(0),(1)'::cube >> '(0),(1)'::cube AS bool;
|
||||
SELECT '(0),(2)'::cube >> '(0),(1)'::cube AS bool;
|
||||
SELECT '(1),(2)'::cube >> '(0),(1)'::cube AS bool;
|
||||
SELECT '(2),(3)'::cube >> '(0),(1)'::cube AS bool;
|
||||
|
||||
|
||||
-- "contained in" (the left operand is the cube entirely enclosed by
|
||||
-- the right operand):
|
||||
|
Loading…
Reference in New Issue
Block a user