Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite0d043b

Browse files
committed
please apply attached patch to current CVS.
btree_gist now supports int2 !Thanks Janko Richter for contribution.
1 parent3be6367 commite0d043b

File tree

4 files changed

+89
-7
lines changed

4 files changed

+89
-7
lines changed

‎contrib/btree_gist/Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,18 @@ top_builddir = ../..
44
include$(top_builddir)/src/Makefile.global
55

66
MODULE_big = btree_gist
7-
OBJS= btree_common.o btree_int4.o btree_int8.o btree_float4.o btree_float8.o btree_ts.o
7+
OBJS= btree_common.obtree_int2.obtree_int4.o btree_int8.o btree_float4.o btree_float8.o btree_ts.o
88
DATA_built = btree_gist.sql
99
DOCS = README.btree_gist
1010
REGRESS = btree_gist
1111

12-
EXTRA_CLEAN = btree_int4.c btree_int8.c btree_float4.c btree_float8.c
12+
EXTRA_CLEAN =btree_int2.cbtree_int4.c btree_int8.c btree_float4.c btree_float8.c
1313

1414
include$(top_srcdir)/contrib/contrib-global.mk
1515

16+
btree_int2.c: btree_num.c.in
17+
sed's,__DEFINE_BTREE_TYPE_HERE__,BTREE_GIST_INT2,g;s,__BTREE_GIST_TYPE__,int16,g;s,__BTREE_GIST_TYPE2__,int2,g'<$<>$@
18+
1619
btree_int4.c: btree_num.c.in
1720
sed's,__DEFINE_BTREE_TYPE_HERE__,BTREE_GIST_INT4,g;s,__BTREE_GIST_TYPE__,int32,g;s,__BTREE_GIST_TYPE2__,int4,g'<$<>$@
1821

‎contrib/btree_gist/README.btree_gist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
This is B-Tree implementation using GiST for int4, int8, float4, float8
1+
This is B-Tree implementation using GiST forint2,int4, int8, float4, float8
22
timestamp types.
33

44
All work was done by Teodor Sigaev (teodor@stack.net) and Oleg Bartunov
55
(oleg@sai.msu.su). See http://www.sai.msu.su/~megera/postgres/gist
66
for additional information.
77

88
NEWS:
9-
Feb 5, 2003 - btree_gist now support int8, float4, float8 !
9+
Feb 5, 2003 - btree_gist now supportint2,int8, float4, float8 !
1010
Thank Janko Richter <jankorichter@yahoo.de> for
1111
contribution.
1212

‎contrib/btree_gist/btree_gist.sql.in

Lines changed: 76 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,23 @@ SET search_path = public;
33

44
SET autocommit TO 'on';
55

6+
-- create type of int2 key
7+
CREATE FUNCTION int2key_in(cstring)
8+
RETURNS int2key
9+
AS 'MODULE_PATHNAME'
10+
LANGUAGE 'c' WITH (isstrict);
11+
12+
CREATE FUNCTION int2key_out(int2key)
13+
RETURNS cstring
14+
AS 'MODULE_PATHNAME'
15+
LANGUAGE 'c' WITH (isstrict);
16+
17+
CREATE TYPE int2key (
18+
INTERNALLENGTH = 4,
19+
INPUT = int2key_in,
20+
OUTPUT = int2key_out
21+
);
22+
623
-- create type of int4 key
724
CREATE FUNCTION int4key_in(cstring)
825
RETURNS int4key
@@ -75,17 +92,17 @@ OUTPUT = float8key_out
7592
--
7693
--
7794
--
78-
--int4 ops
95+
--int2 ops
7996
--
8097
--
8198
--
8299
-- define the GiST support methods
83-
CREATE FUNCTIONgint4_consistent(internal,int4,int2)
100+
CREATE FUNCTIONgint2_consistent(internal,int2,int2)
84101
RETURNS bool
85102
AS 'MODULE_PATHNAME'
86103
LANGUAGE 'C';
87104

88-
CREATE FUNCTIONgint4_compress(internal)
105+
CREATE FUNCTIONgint2_compress(internal)
89106
RETURNS internal
90107
AS 'MODULE_PATHNAME'
91108
LANGUAGE 'C';
@@ -95,6 +112,62 @@ RETURNS internal
95112
AS 'MODULE_PATHNAME'
96113
LANGUAGE 'C';
97114

115+
CREATE FUNCTION gint2_penalty(internal,internal,internal)
116+
RETURNS internal
117+
AS 'MODULE_PATHNAME'
118+
LANGUAGE 'C' WITH (isstrict);
119+
120+
CREATE FUNCTION gint2_picksplit(internal, internal)
121+
RETURNS internal
122+
AS 'MODULE_PATHNAME'
123+
LANGUAGE 'C';
124+
125+
CREATE FUNCTION gint2_union(bytea, internal)
126+
RETURNS int4
127+
AS 'MODULE_PATHNAME'
128+
LANGUAGE 'C';
129+
130+
CREATE FUNCTION gint2_same(internal, internal, internal)
131+
RETURNS internal
132+
AS 'MODULE_PATHNAME'
133+
LANGUAGE 'C';
134+
135+
-- Create the operator class
136+
CREATE OPERATOR CLASS gist_int2_ops
137+
DEFAULT FOR TYPE int2 USING gist
138+
AS
139+
OPERATOR1< ,
140+
OPERATOR2<= ,
141+
OPERATOR3= ,
142+
OPERATOR4>= ,
143+
OPERATOR5> ,
144+
FUNCTION1gint2_consistent (internal, int2, int2),
145+
FUNCTION2gint2_union (bytea, internal),
146+
FUNCTION3gint2_compress (internal),
147+
FUNCTION4btree_decompress (internal),
148+
FUNCTION5gint2_penalty (internal, internal, internal),
149+
FUNCTION6gint2_picksplit (internal, internal),
150+
FUNCTION7gint2_same (internal, internal, internal),
151+
STORAGEint2key;
152+
153+
--
154+
--
155+
--
156+
-- int4 ops
157+
--
158+
--
159+
--
160+
-- define the GiST support methods
161+
CREATE FUNCTION gint4_consistent(internal,int4,int2)
162+
RETURNS bool
163+
AS 'MODULE_PATHNAME'
164+
LANGUAGE 'C';
165+
166+
CREATE FUNCTION gint4_compress(internal)
167+
RETURNS internal
168+
AS 'MODULE_PATHNAME'
169+
LANGUAGE 'C';
170+
98171
CREATE FUNCTION gint4_penalty(internal,internal,internal)
99172
RETURNS internal
100173
AS 'MODULE_PATHNAME'

‎contrib/btree_gist/btree_num.c.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ g__BTREE_GIST_TYPE2___compress(PG_FUNCTION_ARGS)
5151
if (entry->leafkey)
5252
{
5353
__BTREE_GIST_TYPE__KEY *r = ( __BTREE_GIST_TYPE__KEY * ) palloc(sizeof(__BTREE_GIST_TYPE__KEY));
54+
#ifdef BTREE_GIST_INT2
55+
int16leaf = DatumGetInt16(entry->key);
56+
#endif
5457
#ifdef BTREE_GIST_INT4
5558
int32leaf = DatumGetInt32(entry->key);
5659
#endif
@@ -80,6 +83,9 @@ Datum
8083
g__BTREE_GIST_TYPE2___consistent(PG_FUNCTION_ARGS)
8184
{
8285
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
86+
#ifdef BTREE_GIST_INT2
87+
int16query = PG_GETARG_INT16(1);
88+
#endif
8389
#ifdef BTREE_GIST_INT4
8490
int32query = PG_GETARG_INT32(1);
8591
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp