From dcf2e1c8c790e99acb81673bc65ed6fddff4834d Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 27 Jun 2005 01:19:43 +0000 Subject: [PATCH] Remove the << >> &< and &> operators for contrib/cube, which were wrong, but nobody noticed because they were also useless. --- contrib/cube/README.cube | 39 ++--- contrib/cube/cube.c | 84 ----------- contrib/cube/cube.sql.in | 67 +-------- contrib/cube/expected/cube.out | 248 ------------------------------- contrib/cube/expected/cube_1.out | 248 ------------------------------- contrib/cube/expected/cube_2.out | 248 ------------------------------- contrib/cube/sql/cube.sql | 57 ------- 7 files changed, 13 insertions(+), 978 deletions(-) diff --git a/contrib/cube/README.cube b/contrib/cube/README.cube index 3f130c4769..9617009eb2 100644 --- a/contrib/cube/README.cube +++ b/contrib/cube/README.cube @@ -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 diff --git a/contrib/cube/cube.c b/contrib/cube/cube.c index fd0609ee26..cc6e1a39fe 100644 --- a/contrib/cube/cube.c +++ b/contrib/cube/cube.c @@ -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 diff --git a/contrib/cube/cube.sql.in b/contrib/cube/cube.sql.in index bd7137f8f7..ff920d1f59 100644 --- a/contrib/cube/cube.sql.in +++ b/contrib/cube/cube.sql.in @@ -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 ~ , diff --git a/contrib/cube/expected/cube.out b/contrib/cube/expected/cube.out index 367031e983..d1648c53cd 100644 --- a/contrib/cube/expected/cube.out +++ b/contrib/cube/expected/cube.out @@ -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): -- diff --git a/contrib/cube/expected/cube_1.out b/contrib/cube/expected/cube_1.out index f5ee88064c..73a7c2f115 100644 --- a/contrib/cube/expected/cube_1.out +++ b/contrib/cube/expected/cube_1.out @@ -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): -- diff --git a/contrib/cube/expected/cube_2.out b/contrib/cube/expected/cube_2.out index c226c0d11f..cea2f4ea94 100644 --- a/contrib/cube/expected/cube_2.out +++ b/contrib/cube/expected/cube_2.out @@ -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): -- diff --git a/contrib/cube/sql/cube.sql b/contrib/cube/sql/cube.sql index d386a5a2f3..0b22fd768d 100644 --- a/contrib/cube/sql/cube.sql +++ b/contrib/cube/sql/cube.sql @@ -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): -- 2.40.0