2001-08-23 02:27:54 +08:00
|
|
|
begin transaction;
|
|
|
|
|
2002-07-31 01:34:37 +08:00
|
|
|
-- Adjust this setting to control where the objects get created.
|
|
|
|
SET search_path = public;
|
|
|
|
|
|
|
|
-- create type of int4 key
|
2001-08-23 02:27:54 +08:00
|
|
|
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';
|
|
|
|
|
2002-07-31 01:34:37 +08:00
|
|
|
-- 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;
|
2001-08-23 02:27:54 +08:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
--
|
|
|
|
--
|
|
|
|
-- 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';
|
|
|
|
|
2002-07-31 01:34:37 +08:00
|
|
|
-- 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;
|
2001-08-23 02:27:54 +08:00
|
|
|
|
|
|
|
|
|
|
|
end transaction;
|