1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-11 20:28:21 +03:00

please apply attached patch to current CVS.

btree_gist now supports int2 !
Thanks Janko Richter for contribution.
This commit is contained in:
Bruce Momjian
2003-03-20 18:59:18 +00:00
parent 3be6367b9f
commit e0d043b94d
4 changed files with 91 additions and 9 deletions

View File

@ -3,6 +3,23 @@ SET search_path = public;
SET autocommit TO 'on';
-- create type of int2 key
CREATE FUNCTION int2key_in(cstring)
RETURNS int2key
AS 'MODULE_PATHNAME'
LANGUAGE 'c' WITH (isstrict);
CREATE FUNCTION int2key_out(int2key)
RETURNS cstring
AS 'MODULE_PATHNAME'
LANGUAGE 'c' WITH (isstrict);
CREATE TYPE int2key (
INTERNALLENGTH = 4,
INPUT = int2key_in,
OUTPUT = int2key_out
);
-- create type of int4 key
CREATE FUNCTION int4key_in(cstring)
RETURNS int4key
@ -72,6 +89,67 @@ INPUT = float8key_in,
OUTPUT = float8key_out
);
--
--
--
-- int2 ops
--
--
--
-- define the GiST support methods
CREATE FUNCTION gint2_consistent(internal,int2,int2)
RETURNS bool
AS 'MODULE_PATHNAME'
LANGUAGE 'C';
CREATE FUNCTION gint2_compress(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE 'C';
CREATE FUNCTION btree_decompress(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE 'C';
CREATE FUNCTION gint2_penalty(internal,internal,internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE 'C' WITH (isstrict);
CREATE FUNCTION gint2_picksplit(internal, internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE 'C';
CREATE FUNCTION gint2_union(bytea, internal)
RETURNS int4
AS 'MODULE_PATHNAME'
LANGUAGE 'C';
CREATE FUNCTION gint2_same(internal, internal, internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE 'C';
-- Create the operator class
CREATE OPERATOR CLASS gist_int2_ops
DEFAULT FOR TYPE int2 USING gist
AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
OPERATOR 3 = ,
OPERATOR 4 >= ,
OPERATOR 5 > ,
FUNCTION 1 gint2_consistent (internal, int2, int2),
FUNCTION 2 gint2_union (bytea, internal),
FUNCTION 3 gint2_compress (internal),
FUNCTION 4 btree_decompress (internal),
FUNCTION 5 gint2_penalty (internal, internal, internal),
FUNCTION 6 gint2_picksplit (internal, internal),
FUNCTION 7 gint2_same (internal, internal, internal),
STORAGE int2key;
--
--
--
@ -90,11 +168,6 @@ 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'