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 hash
function
in the ./backend/access/hash/hashfunc.c should return.

Also, could someone (maybe Tomas Lockhart?) look-over the patch and make
sure
the system table entries are correct?  I've tried to research them as
much as I
could, but some of them are still not clear to me.

Thanks,
-Ryan
This commit is contained in:
Bruce Momjian 1999-03-14 05:09:05 +00:00
parent f9f458be10
commit 817a3e6d39
7 changed files with 44 additions and 7 deletions

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.13 1999/02/13 23:14:18 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.14 1999/03/14 05:08:55 momjian Exp $
*
* NOTES
* These functions are stored in pg_amproc. For each operator class
@ -32,6 +32,12 @@ hashint4(uint32 key)
return ~key;
}
uint32
hashint8(uint64 *key)
{
return ~((uint32)key);
}
/* Hash function from Chris Torek. */
uint32
hashfloat4(float32 keyp)

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.21 1999/02/13 23:14:31 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.22 1999/03/14 05:08:56 momjian Exp $
*
* NOTES
* These functions are stored in pg_amproc. For each operator class
@ -39,6 +39,17 @@ btint4cmp(int32 a, int32 b)
return a - b;
}
int32
btint8cmp(int64 *a, int64 *b)
{
if (*a > *b)
return 1;
else if (*a == *b)
return 0;
else
return -1;
}
int32
btint24cmp(int16 a, int32 b)
{

View File

@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_amop.h,v 1.19 1999/02/13 23:21:05 momjian Exp $
* $Id: pg_amop.h,v 1.20 1999/03/14 05:08:57 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@ -167,6 +167,16 @@ DATA(insert OID = 0 ( 403 426 96 3 btreesel btreenpage ));
DATA(insert OID = 0 ( 403 426 525 4 btreesel btreenpage ));
DATA(insert OID = 0 ( 403 426 521 5 btreesel btreenpage ));
/*
* nbtree int8_ops
*/
DATA(insert OID = 0 ( 403 754 412 1 btreesel btreenpage ));
DATA(insert OID = 0 ( 403 754 414 2 btreesel btreenpage ));
DATA(insert OID = 0 ( 403 754 410 3 btreesel btreenpage ));
DATA(insert OID = 0 ( 403 754 415 4 btreesel btreenpage ));
DATA(insert OID = 0 ( 403 754 413 5 btreesel btreenpage ));
/*
* nbtree oid_ops
*/
@ -338,6 +348,8 @@ DATA(insert OID = 0 ( 405 421 94 1 hashsel hashnpage ));
DATA(insert OID = 0 ( 405 423 670 1 hashsel hashnpage ));
/* int4_ops */
DATA(insert OID = 0 ( 405 426 96 1 hashsel hashnpage ));
/* int8_ops */
DATA(insert OID = 0 ( 405 426 96 1 hashsel hashnpage ));
/* oid_ops */
DATA(insert OID = 0 ( 405 427 607 1 hashsel hashnpage ));
/* oid8_ops */

View File

@ -9,7 +9,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_amproc.h,v 1.12 1999/02/13 23:21:06 momjian Exp $
* $Id: pg_amproc.h,v 1.13 1999/03/14 05:08:58 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@ -92,6 +92,7 @@ DATA(insert OID = 0 (403 432 357 1));
DATA(insert OID = 0 (403 435 404 1));
DATA(insert OID = 0 (403 436 948 1));
DATA(insert OID = 0 (403 437 828 1));
DATA(insert OID = 0 (403 754 842 1));
DATA(insert OID = 0 (403 1076 1078 1));
DATA(insert OID = 0 (403 1077 1079 1));
DATA(insert OID = 0 (403 1114 1092 1));

View File

@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_opclass.h,v 1.16 1999/02/13 23:21:11 momjian Exp $
* $Id: pg_opclass.h,v 1.17 1999/03/14 05:08:59 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@ -93,6 +93,8 @@ DATA(insert OID = 435 ( oid8_ops 30 ));
DESCR("");
DATA(insert OID = 714 ( circle_ops 718 ));
DESCR("");
DATA(insert OID = 754 ( int8_ops 20 ));
DESCR("");
DATA(insert OID = 1076 ( bpchar_ops 1042 ));
DESCR("");
DATA(insert OID = 1077 ( varchar_ops 1043 ));

View File

@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_proc.h,v 1.90 1999/03/10 05:02:33 tgl Exp $
* $Id: pg_proc.h,v 1.91 1999/03/14 05:09:00 momjian Exp $
*
* NOTES
* 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
DESCR("btree less-equal-greater");
DATA(insert OID = 351 ( btint4cmp PGUID 11 f t f 2 f 23 "23 23" 100 0 0 100 foo bar ));
DESCR("btree less-equal-greater");
DATA(insert OID = 842 ( btint8cmp PGUID 11 f t f 2 f 23 "20 20" 100 0 0 100 foo bar ));
DESCR("btree less-equal-greater");
DATA(insert OID = 352 ( btint42cmp PGUID 11 f t f 2 f 23 "23 21" 100 0 0 100 foo bar ));
DESCR("btree less-equal-greater");
DATA(insert OID = 353 ( btint24cmp PGUID 11 f t f 2 f 23 "21 23" 100 0 0 100 foo bar ));
@ -821,6 +823,8 @@ DATA(insert OID = 449 ( hashint2 PGUID 11 f t f 2 f 23 "21 21" 100 0 0 100
DESCR("hash");
DATA(insert OID = 450 ( hashint4 PGUID 11 f t f 2 f 23 "23 23" 100 0 0 100 foo bar ));
DESCR("hash");
DATA(insert OID = 949 ( hashint8 PGUID 11 f t f 2 f 23 "20 20" 100 0 0 100 foo bar ));
DESCR("hash");
DATA(insert OID = 451 ( hashfloat4 PGUID 11 f t f 2 f 23 "700 700" 100 0 0 100 foo bar ));
DESCR("hash");
DATA(insert OID = 452 ( hashfloat8 PGUID 11 f t f 2 f 23 "701 701" 100 0 0 100 foo bar ));

View File

@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: builtins.h,v 1.74 1999/02/13 23:22:15 momjian Exp $
* $Id: builtins.h,v 1.75 1999/03/14 05:09:05 momjian Exp $
*
* NOTES
* This should normally only be included by fmgr.h.
@ -163,6 +163,7 @@ extern void ltoa(int32 l, char *a);
*/
extern int32 btint2cmp(int16 a, int16 b);
extern int32 btint4cmp(int32 a, int32 b);
extern int32 btint8cmp(int64 *a, int64 *b);
extern int32 btint24cmp(int16 a, int32 b);
extern int32 btint42cmp(int32 a, int16 b);
extern int32 btfloat4cmp(float32 a, float32 b);