postgresql/contrib/btree_gist/btree_gist.sql.in
Tom Lane 65b6868b13 Replace ad-hoc insertions into pg_opclass and friends with CREATE
OPERATOR CLASS commands.  Further tweaking of documentation for same.
2002-07-30 17:34:37 +00:00

120 lines
3.1 KiB
MySQL

begin transaction;
-- Adjust this setting to control where the objects get created.
SET search_path = public;
-- create type of int4 key
CREATE FUNCTION int4key_in(opaque)
RETURNS opaque
AS 'MODULE_PATHNAME'
LANGUAGE 'c' with (isstrict);
CREATE FUNCTION int4key_out(opaque)
RETURNS opaque
AS 'MODULE_PATHNAME'
LANGUAGE 'c' with (isstrict);
CREATE TYPE int4key (
internallength = 8,
input = int4key_in,
output = int4key_out
);
--
--
--
-- int4 ops
--
--
--
-- define the GiST support methods
create function gint4_consistent(opaque,int4,int2) returns bool as 'MODULE_PATHNAME' language 'C';
create function gint4_compress(opaque) returns opaque as 'MODULE_PATHNAME' language 'C';
create function btree_decompress(opaque) returns opaque as 'MODULE_PATHNAME' language 'C';
create function gint4_penalty(opaque,opaque,opaque) returns opaque as 'MODULE_PATHNAME' language 'C' with(isstrict);
create function gint4_picksplit(opaque, opaque) returns opaque as 'MODULE_PATHNAME' language 'C';
create function gint4_union(bytea, opaque) returns int4 as 'MODULE_PATHNAME' language 'C';
create function gint4_same(opaque, opaque, opaque) returns opaque as 'MODULE_PATHNAME' language 'C';
-- Create the operator class
CREATE OPERATOR CLASS gist_int4_ops
DEFAULT FOR TYPE int4 USING gist AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
OPERATOR 3 = ,
OPERATOR 4 >= ,
OPERATOR 5 > ,
FUNCTION 1 gint4_consistent (opaque, int4, int2),
FUNCTION 2 gint4_union (bytea, opaque),
FUNCTION 3 gint4_compress (opaque),
FUNCTION 4 btree_decompress (opaque),
FUNCTION 5 gint4_penalty (opaque, opaque, opaque),
FUNCTION 6 gint4_picksplit (opaque, opaque),
FUNCTION 7 gint4_same (opaque, opaque, opaque),
STORAGE int4key;
--
--
--
-- timestamp ops
--
--
--
-- create type of timestamp key
CREATE FUNCTION tskey_in(opaque)
RETURNS opaque
AS 'MODULE_PATHNAME'
LANGUAGE 'c' with (isstrict);
CREATE FUNCTION tskey_out(opaque)
RETURNS opaque
AS 'MODULE_PATHNAME'
LANGUAGE 'c' with (isstrict);
CREATE TYPE tskey (
internallength = 16,
input = tskey_in,
output = tskey_out
);
create function gts_consistent(opaque,timestamp,int2) returns bool as 'MODULE_PATHNAME' language 'C';
create function gts_compress(opaque) returns opaque as 'MODULE_PATHNAME' language 'C';
create function gts_penalty(opaque,opaque,opaque) returns opaque as 'MODULE_PATHNAME' language 'C' with(isstrict);
create function gts_picksplit(opaque, opaque) returns opaque as 'MODULE_PATHNAME' language 'C';
create function gts_union(bytea, opaque) returns int4 as 'MODULE_PATHNAME' language 'C';
create function gts_same(opaque, opaque, opaque) returns opaque as 'MODULE_PATHNAME' language 'C';
-- Create the operator class
CREATE OPERATOR CLASS gist_timestamp_ops
DEFAULT FOR TYPE timestamp USING gist AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
OPERATOR 3 = ,
OPERATOR 4 >= ,
OPERATOR 5 > ,
FUNCTION 1 gts_consistent (opaque, timestamp, int2),
FUNCTION 2 gts_union (bytea, opaque),
FUNCTION 3 gts_compress (opaque),
FUNCTION 4 btree_decompress (opaque),
FUNCTION 5 gts_penalty (opaque, opaque, opaque),
FUNCTION 6 gts_picksplit (opaque, opaque),
FUNCTION 7 gts_same (opaque, opaque, opaque),
STORAGE tskey;
end transaction;