From: | Paul Matthews <plm(at)netspace(dot)net(dot)au> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Geometric Elimination |
Date: | 2009-08-21 10:28:05 |
Message-ID: | 4A8E76B5.50002@netspace.net.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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);
}
From | Date | Subject | |
---|---|---|---|
Next Message | Martijn van Oosterhout | 2009-08-21 10:51:33 | Re: Geometric Elimination |
Previous Message | Jeff Janes | 2009-08-21 08:18:46 | XLogFlush |