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
|
2002-08-22 08:01:51 +08:00
|
|
|
CREATE FUNCTION int4key_in(cstring)
|
|
|
|
RETURNS int4key
|
2001-08-23 02:27:54 +08:00
|
|
|
AS 'MODULE_PATHNAME'
|
|
|
|
LANGUAGE 'c' with (isstrict);
|
|
|
|
|
2002-08-22 08:01:51 +08:00
|
|
|
CREATE FUNCTION int4key_out(int4key)
|
|
|
|
RETURNS cstring
|
2001-08-23 02:27:54 +08:00
|
|
|
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
|
2002-08-22 08:01:51 +08:00
|
|
|
create function gint4_consistent(internal,int4,int2) returns bool as 'MODULE_PATHNAME' language 'C';
|
2001-08-23 02:27:54 +08:00
|
|
|
|
2002-08-22 08:01:51 +08:00
|
|
|
create function gint4_compress(internal) returns internal as 'MODULE_PATHNAME' language 'C';
|
2001-08-23 02:27:54 +08:00
|
|
|
|
2002-08-22 08:01:51 +08:00
|
|
|
create function btree_decompress(internal) returns internal as 'MODULE_PATHNAME' language 'C';
|
2001-08-23 02:27:54 +08:00
|
|
|
|
2002-08-22 08:01:51 +08:00
|
|
|
create function gint4_penalty(internal,internal,internal) returns internal as 'MODULE_PATHNAME' language 'C' with(isstrict);
|
2001-08-23 02:27:54 +08:00
|
|
|
|
2002-08-22 08:01:51 +08:00
|
|
|
create function gint4_picksplit(internal, internal) returns internal as 'MODULE_PATHNAME' language 'C';
|
2001-08-23 02:27:54 +08:00
|
|
|
|
2002-08-22 08:01:51 +08:00
|
|
|
create function gint4_union(bytea, internal) returns int4 as 'MODULE_PATHNAME' language 'C';
|
2001-08-23 02:27:54 +08:00
|
|
|
|
2002-08-22 08:01:51 +08:00
|
|
|
create function gint4_same(internal, internal, internal) returns internal as 'MODULE_PATHNAME' language 'C';
|
2001-08-23 02:27:54 +08:00
|
|
|
|
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 > ,
|
2002-08-22 08:01:51 +08:00
|
|
|
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),
|
2002-07-31 01:34:37 +08:00
|
|
|
STORAGE int4key;
|
2001-08-23 02:27:54 +08:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
--
|
|
|
|
--
|
|
|
|
-- timestamp ops
|
|
|
|
--
|
|
|
|
--
|
|
|
|
--
|
|
|
|
-- create type of timestamp key
|
|
|
|
|
2002-08-22 08:01:51 +08:00
|
|
|
CREATE FUNCTION tskey_in(cstring)
|
|
|
|
RETURNS tskey
|
2001-08-23 02:27:54 +08:00
|
|
|
AS 'MODULE_PATHNAME'
|
|
|
|
LANGUAGE 'c' with (isstrict);
|
|
|
|
|
2002-08-22 08:01:51 +08:00
|
|
|
CREATE FUNCTION tskey_out(tskey)
|
|
|
|
RETURNS cstring
|
2001-08-23 02:27:54 +08:00
|
|
|
AS 'MODULE_PATHNAME'
|
|
|
|
LANGUAGE 'c' with (isstrict);
|
|
|
|
|
|
|
|
CREATE TYPE tskey (
|
|
|
|
internallength = 16,
|
|
|
|
input = tskey_in,
|
|
|
|
output = tskey_out
|
|
|
|
);
|
|
|
|
|
2002-08-22 08:01:51 +08:00
|
|
|
create function gts_consistent(internal,timestamp,int2) returns bool as 'MODULE_PATHNAME' language 'C';
|
2001-08-23 02:27:54 +08:00
|
|
|
|
2002-08-22 08:01:51 +08:00
|
|
|
create function gts_compress(internal) returns internal as 'MODULE_PATHNAME' language 'C';
|
2001-08-23 02:27:54 +08:00
|
|
|
|
2002-08-22 08:01:51 +08:00
|
|
|
create function gts_penalty(internal,internal,internal) returns internal as 'MODULE_PATHNAME' language 'C' with(isstrict);
|
2001-08-23 02:27:54 +08:00
|
|
|
|
2002-08-22 08:01:51 +08:00
|
|
|
create function gts_picksplit(internal, internal) returns internal as 'MODULE_PATHNAME' language 'C';
|
2001-08-23 02:27:54 +08:00
|
|
|
|
2002-08-22 08:01:51 +08:00
|
|
|
create function gts_union(bytea, internal) returns int4 as 'MODULE_PATHNAME' language 'C';
|
2001-08-23 02:27:54 +08:00
|
|
|
|
2002-08-22 08:01:51 +08:00
|
|
|
create function gts_same(internal, internal, internal) returns internal as 'MODULE_PATHNAME' language 'C';
|
2001-08-23 02:27:54 +08:00
|
|
|
|
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 > ,
|
2002-08-22 08:01:51 +08:00
|
|
|
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),
|
2002-07-31 01:34:37 +08:00
|
|
|
STORAGE tskey;
|
2001-08-23 02:27:54 +08:00
|
|
|
|
|
|
|
|
|
|
|
end transaction;
|