[postgis-users] Strange behaviour of = operator

strk at refractions.net strk at refractions.net
Tue Feb 7 08:07:51 PST 2006


On Tue, Feb 07, 2006 at 03:47:19PM -0000, Mark Cave-Ayland wrote:

(cuts)

> create or replace function btree_equals_opclass(geometry, geometry) returns
> integer as $$
>   begin
>   if equals($1,$2) then
>     return 1;
>   else
>     return 0;
>   end if;
> end;
> $$
> language plpgsql;
> 
> CREATE OPERATOR = (
>    LEFTARG = geometry, RIGHTARG = geometry, PROCEDURE = btree_equals,
>    COMMUTATOR = '=', -- we might implement a faster negator here
>    RESTRICT = contsel, JOIN = contjoinsel
> );
> 
> CREATE OPERATOR CLASS btree_geometry_ops DEFAULT
>    FOR TYPE geometry USING btree AS
>    OPERATOR 1  <,
>    OPERATOR 2  <=,
>    OPERATOR 3  =,
>    OPERATOR 4  >=,
>    OPERATOR 5  >,
>    FUNCTION 1  btree_equals_opclass(geometry, geometry);

I think that FUNCTION 1 of btree opclass wants a comparator,
returning -1, 0, 1 for less then, equal, greater then.
Please correct me if I'm wrong.

--strk;



More information about the postgis-users mailing list