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

Commit817a3e6

Browse files
committed
Enclosed below I have a patch to allow a btree index on the int8 type.
I would like some feedback on what the hash function for the int8 hashfunctionin the ./backend/access/hash/hashfunc.c should return.Also, could someone (maybe Tomas Lockhart?) look-over the patch and makesurethe system table entries are correct? I've tried to research them asmuch as Icould, but some of them are still not clear to me.Thanks,-Ryan
1 parentf9f458b commit817a3e6

File tree

7 files changed

+44
-7
lines changed

7 files changed

+44
-7
lines changed

‎src/backend/access/hash/hashfunc.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.13 1999/02/13 23:14:18 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.14 1999/03/14 05:08:55 momjian Exp $
1111
*
1212
* NOTES
1313
* These functions are stored in pg_amproc.For each operator class
@@ -32,6 +32,12 @@ hashint4(uint32 key)
3232
return ~key;
3333
}
3434

35+
uint32
36+
hashint8(uint64*key)
37+
{
38+
return ~((uint32)key);
39+
}
40+
3541
/* Hash function from Chris Torek. */
3642
uint32
3743
hashfloat4(float32keyp)

‎src/backend/access/nbtree/nbtcompare.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.21 1999/02/13 23:14:31 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.22 1999/03/14 05:08:56 momjian Exp $
1111
*
1212
*NOTES
1313
*These functions are stored in pg_amproc. For each operator class
@@ -39,6 +39,17 @@ btint4cmp(int32 a, int32 b)
3939
returna-b;
4040
}
4141

42+
int32
43+
btint8cmp(int64*a,int64*b)
44+
{
45+
if (*a>*b)
46+
return1;
47+
elseif (*a==*b)
48+
return0;
49+
else
50+
return-1;
51+
}
52+
4253
int32
4354
btint24cmp(int16a,int32b)
4455
{

‎src/include/catalog/pg_amop.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: pg_amop.h,v 1.19 1999/02/13 23:21:05 momjian Exp $
10+
* $Id: pg_amop.h,v 1.20 1999/03/14 05:08:57 momjian Exp $
1111
*
1212
* NOTES
1313
* the genbki.sh script reads this file and generates .bki
@@ -167,6 +167,16 @@ DATA(insert OID = 0 ( 403 42696 3 btreesel btreenpage ));
167167
DATA(insertOID=0 (4034265254btreeselbtreenpage ));
168168
DATA(insertOID=0 (4034265215btreeselbtreenpage ));
169169

170+
/*
171+
*nbtree int8_ops
172+
*/
173+
174+
DATA(insertOID=0 (4037544121btreeselbtreenpage ));
175+
DATA(insertOID=0 (4037544142btreeselbtreenpage ));
176+
DATA(insertOID=0 (4037544103btreeselbtreenpage ));
177+
DATA(insertOID=0 (4037544154btreeselbtreenpage ));
178+
DATA(insertOID=0 (4037544135btreeselbtreenpage ));
179+
170180
/*
171181
*nbtree oid_ops
172182
*/
@@ -338,6 +348,8 @@ DATA(insert OID = 0 ( 405421 94 1 hashsel hashnpage ));
338348
DATA(insertOID=0 (4054236701hashselhashnpage ));
339349
/* int4_ops */
340350
DATA(insertOID=0 (405426961hashselhashnpage ));
351+
/* int8_ops */
352+
DATA(insertOID=0 (405426961hashselhashnpage ));
341353
/* oid_ops */
342354
DATA(insertOID=0 (4054276071hashselhashnpage ));
343355
/* oid8_ops */

‎src/include/catalog/pg_amproc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
* Copyright (c) 1994, Regents of the University of California
1111
*
12-
* $Id: pg_amproc.h,v 1.12 1999/02/13 23:21:06 momjian Exp $
12+
* $Id: pg_amproc.h,v 1.13 1999/03/14 05:08:58 momjian Exp $
1313
*
1414
* NOTES
1515
* the genbki.sh script reads this file and generates .bki
@@ -92,6 +92,7 @@ DATA(insert OID = 0 (403 432 357 1));
9292
DATA(insertOID=0 (4034354041));
9393
DATA(insertOID=0 (4034369481));
9494
DATA(insertOID=0 (4034378281));
95+
DATA(insertOID=0 (4037548421));
9596
DATA(insertOID=0 (403107610781));
9697
DATA(insertOID=0 (403107710791));
9798
DATA(insertOID=0 (403111410921));

‎src/include/catalog/pg_opclass.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: pg_opclass.h,v 1.16 1999/02/13 23:21:11 momjian Exp $
10+
* $Id: pg_opclass.h,v 1.17 1999/03/14 05:08:59 momjian Exp $
1111
*
1212
* NOTES
1313
* the genbki.sh script reads this file and generates .bki
@@ -93,6 +93,8 @@ DATA(insert OID = 435 (oid8_ops 30 ));
9393
DESCR("");
9494
DATA(insertOID=714 (circle_ops718 ));
9595
DESCR("");
96+
DATA(insertOID=754 (int8_ops20 ));
97+
DESCR("");
9698
DATA(insertOID=1076 (bpchar_ops1042 ));
9799
DESCR("");
98100
DATA(insertOID=1077 (varchar_ops1043 ));

‎src/include/catalog/pg_proc.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: pg_proc.h,v 1.90 1999/03/10 05:02:33 tgl Exp $
9+
* $Id: pg_proc.h,v 1.91 1999/03/14 05:09:00 momjian Exp $
1010
*
1111
* NOTES
1212
* The script catalog/genbki.sh reads this file and generates .bki
@@ -735,6 +735,8 @@ DATA(insert OID = 350 ( btint2cmp PGUID 11 f t f 2 f 23 "21 21" 100 0 0 100
735735
DESCR("btree less-equal-greater");
736736
DATA(insertOID=351 (btint4cmpPGUID11ftf2f23"23 23"10000100foobar ));
737737
DESCR("btree less-equal-greater");
738+
DATA(insertOID=842 (btint8cmpPGUID11ftf2f23"20 20"10000100foobar ));
739+
DESCR("btree less-equal-greater");
738740
DATA(insertOID=352 (btint42cmpPGUID11ftf2f23"23 21"10000100foobar ));
739741
DESCR("btree less-equal-greater");
740742
DATA(insertOID=353 (btint24cmpPGUID11ftf2f23"21 23"10000100foobar ));
@@ -821,6 +823,8 @@ DATA(insert OID = 449 ( hashint2 PGUID 11 f t f 2 f 23 "21 21" 100 0 0 100
821823
DESCR("hash");
822824
DATA(insertOID=450 (hashint4PGUID11ftf2f23"23 23"10000100foobar ));
823825
DESCR("hash");
826+
DATA(insertOID=949 (hashint8PGUID11ftf2f23"20 20"10000100foobar ));
827+
DESCR("hash");
824828
DATA(insertOID=451 (hashfloat4PGUID11ftf2f23"700 700"10000100foobar ));
825829
DESCR("hash");
826830
DATA(insertOID=452 (hashfloat8PGUID11ftf2f23"701 701"10000100foobar ));

‎src/include/utils/builtins.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: builtins.h,v 1.74 1999/02/13 23:22:15 momjian Exp $
9+
* $Id: builtins.h,v 1.75 1999/03/14 05:09:05 momjian Exp $
1010
*
1111
* NOTES
1212
* This should normally only be included by fmgr.h.
@@ -163,6 +163,7 @@ extern void ltoa(int32 l, char *a);
163163
*/
164164
externint32btint2cmp(int16a,int16b);
165165
externint32btint4cmp(int32a,int32b);
166+
externint32btint8cmp(int64*a,int64*b);
166167
externint32btint24cmp(int16a,int32b);
167168
externint32btint42cmp(int32a,int16b);
168169
externint32btfloat4cmp(float32a,float32b);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp