Geometric Elimination

Поиск
Список
Период
Сортировка
От Paul Matthews
Тема Geometric Elimination
Дата
Msg-id 4A8E76B5.50002@netspace.net.au
обсуждение исходный текст
Ответы Re: Geometric Elimination  (Martijn van Oosterhout <kleptog@svana.org>)
Re: Geometric Elimination  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Trying to solve this problem by using a process of elimination. All
works fine until the comment below is removed.

ALTER OPERATOR FAMILY box_ops USING GiST ADD OPERATOR 1  <<  (box,point), OPERATOR 2  &<  (box,point), OPERATOR 3  &&
(box,point),OPERATOR 4  &>  (box,point), OPERATOR 5  >>  (box,point), 
 
--  OPERATOR 7  @>  (box,point), OPERATOR 9  &<| (box,point), OPERATOR 10 <<| (box,point), OPERATOR 11 |>>
(box,point);

Ah! So operator @> is wrong.

DROP OPERATOR IF EXISTS @>(box,point);
CREATE OPERATOR @> ( LEFTARG    = box, RIGHTARG   = point, PROCEDURE  = contains, COMMUTATOR = <@, RESTRICT   =
contsel,JOIN       = contjoinsel
 
);

No, all seems fine here. Maybe the definition of the function is incorrect

CREATE OR REPLACE FUNCTION contains(box,point) RETURNS boolean
LANGUAGE C IMMUTABLE STRICT
AS 'contains.so', 'box_point_contains';

The C function? No it seems OK as well. What am I missing? It must be
completely obvious. Someone is laughing out there. Put me out of my
misery please!

/** Box contains point. box @> point.*/
Datum box_point_contains(PG_FUNCTION_ARGS)
{ BOX   *box   = PG_GETARG_BOX_P(0); Point *point = PG_GETARG_POINT_P(1); int    isin  = point->x >= box->low.x  &&
          point->x <= box->high.x &&                point->y >= box->low.y  &&                point->y <= box->high.y;
PG_RETURN_BOOL(isin);
}


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Jeff Janes
Дата:
Сообщение: XLogFlush
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Geometric Elimination