postgresql/contrib/btree_gist/btree_gist.sql.in

120 lines
3.3 KiB
MySQL
Raw Normal View History

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(cstring)
RETURNS int4key
AS 'MODULE_PATHNAME'
LANGUAGE 'c' with (isstrict);
CREATE FUNCTION int4key_out(int4key)
RETURNS cstring
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(internal,int4,int2) returns bool as 'MODULE_PATHNAME' language 'C';
create function gint4_compress(internal) returns internal as 'MODULE_PATHNAME' language 'C';
create function btree_decompress(internal) returns internal as 'MODULE_PATHNAME' language 'C';
create function gint4_penalty(internal,internal,internal) returns internal as 'MODULE_PATHNAME' language 'C' with(isstrict);
create function gint4_picksplit(internal, internal) returns internal as 'MODULE_PATHNAME' language 'C';
create function gint4_union(bytea, internal) returns int4 as 'MODULE_PATHNAME' language 'C';
create function gint4_same(internal, internal, internal) returns internal 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 (internal, int4, int2),
FUNCTION 2 gint4_union (bytea, internal),
FUNCTION 3 gint4_compress (internal),
FUNCTION 4 btree_decompress (internal),
FUNCTION 5 gint4_penalty (internal, internal, internal),
FUNCTION 6 gint4_picksplit (internal, internal),
FUNCTION 7 gint4_same (internal, internal, internal),
STORAGE int4key;
--
--
--
-- timestamp ops
--
--
--
-- create type of timestamp key
CREATE FUNCTION tskey_in(cstring)
RETURNS tskey
AS 'MODULE_PATHNAME'
LANGUAGE 'c' with (isstrict);
CREATE FUNCTION tskey_out(tskey)
RETURNS cstring
AS 'MODULE_PATHNAME'
LANGUAGE 'c' with (isstrict);
CREATE TYPE tskey (
internallength = 16,
input = tskey_in,
output = tskey_out
);
create function gts_consistent(internal,timestamp,int2) returns bool as 'MODULE_PATHNAME' language 'C';
create function gts_compress(internal) returns internal as 'MODULE_PATHNAME' language 'C';
create function gts_penalty(internal,internal,internal) returns internal as 'MODULE_PATHNAME' language 'C' with(isstrict);
create function gts_picksplit(internal, internal) returns internal as 'MODULE_PATHNAME' language 'C';
create function gts_union(bytea, internal) returns int4 as 'MODULE_PATHNAME' language 'C';
create function gts_same(internal, internal, internal) returns internal 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 (internal, timestamp, int2),
FUNCTION 2 gts_union (bytea, internal),
FUNCTION 3 gts_compress (internal),
FUNCTION 4 btree_decompress (internal),
FUNCTION 5 gts_penalty (internal, internal, internal),
FUNCTION 6 gts_picksplit (internal, internal),
FUNCTION 7 gts_same (internal, internal, internal),
STORAGE tskey;
end transaction;