begin transaction;

-- Adjust this setting to control where the objects get created.
SET search_path = public;

--
--
--
-- BOX ops
--
--
--
-- define the GiST support methods
create function gbox_consistent(opaque,box,int4) returns bool as 'MODULE_PATHNAME' language 'C';

create function gbox_compress(opaque) returns opaque as 'MODULE_PATHNAME' language 'C';

create function rtree_decompress(opaque) returns opaque as 'MODULE_PATHNAME' language 'C';

create function gbox_penalty(opaque,opaque,opaque) returns opaque as 'MODULE_PATHNAME' language 'C' with (isstrict);

create function gbox_picksplit(opaque, opaque) returns opaque as 'MODULE_PATHNAME' language 'C';

create function gbox_union(bytea, opaque) returns box as 'MODULE_PATHNAME' language 'C';

create function gbox_same(box, box, opaque) returns opaque as 'MODULE_PATHNAME' language 'C';

-- create the operator class
CREATE OPERATOR CLASS gist_box_ops
    DEFAULT FOR TYPE box USING gist AS
	OPERATOR	1	<< ,
	OPERATOR	2	&< ,
	OPERATOR	3	&& ,
	OPERATOR	4	&> ,
	OPERATOR	5	>> ,
	OPERATOR	6	~= ,
	OPERATOR	7	~ ,
	OPERATOR	8	@ ,
	FUNCTION	1	gbox_consistent (opaque, box, int4),
	FUNCTION	2	gbox_union (bytea, opaque),
	FUNCTION	3	gbox_compress (opaque),
	FUNCTION	4	rtree_decompress (opaque),
	FUNCTION	5	gbox_penalty (opaque, opaque, opaque),
	FUNCTION	6	gbox_picksplit (opaque, opaque),
	FUNCTION	7	gbox_same (box, box, opaque);


--
--
--
-- POLYGON ops
--
--
--
-- define the GiST support methods
create function gpoly_consistent(opaque,polygon,int4) returns bool as 'MODULE_PATHNAME' language 'C';

create function gpoly_compress(opaque) returns opaque as 'MODULE_PATHNAME' language 'C';

-- create the operator class
CREATE OPERATOR CLASS gist_poly_ops
    DEFAULT FOR TYPE polygon USING gist AS
	OPERATOR	1	<<	RECHECK ,
	OPERATOR	2	&<	RECHECK ,
	OPERATOR	3	&&	RECHECK ,
	OPERATOR	4	&>	RECHECK ,
	OPERATOR	5	>>	RECHECK ,
	OPERATOR	6	~=	RECHECK ,
	OPERATOR	7	~	RECHECK ,
	OPERATOR	8	@	RECHECK ,
	FUNCTION	1	gpoly_consistent (opaque, polygon, int4),
	FUNCTION	2	gbox_union (bytea, opaque),
	FUNCTION	3	gpoly_compress (opaque),
	FUNCTION	4	rtree_decompress (opaque),
	FUNCTION	5	gbox_penalty (opaque, opaque, opaque),
	FUNCTION	6	gbox_picksplit (opaque, opaque),
	FUNCTION	7	gbox_same (box, box, opaque),
	STORAGE		box;


end transaction;
