]> granicus.if.org Git - postgresql/commitdiff
Enclosed below I have a patch to allow a btree index on the int8 type.
authorBruce Momjian <bruce@momjian.us>
Sun, 14 Mar 1999 05:09:05 +0000 (05:09 +0000)
committerBruce Momjian <bruce@momjian.us>
Sun, 14 Mar 1999 05:09:05 +0000 (05:09 +0000)
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

src/backend/access/hash/hashfunc.c
src/backend/access/nbtree/nbtcompare.c
src/include/catalog/pg_amop.h
src/include/catalog/pg_amproc.h
src/include/catalog/pg_opclass.h
src/include/catalog/pg_proc.h
src/include/utils/builtins.h

index 7233685a22d64464c3c3ead6eac2956f2f2aec65..a4eba181a7eda7d9ae71858493c761600b8e91bf 100644 (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)
index 108166fc441ac1c02894b6e822716820e54d76a8..127f2b035760b96fddf774cde0097da4d6e8b2e5 100644 (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)
 {
index 3491a44db059876d66e13f79fbdf4e169bf1ef40..b9860030bbf6751dc469107d4bda086d3ace5f88 100644 (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 */
index 47395fdbdbaeb907691531f2c83f71519cd91ce4..6e7cb589f694a3f6ff76e07896d650f869287da9 100644 (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));
index 5ced96a40418c76e62b2c76f270171fd2940f8b6..7b66fe284a9b075e09cef94318724145e053be3f 100644 (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   ));
index a71f1ef52610fc628e23e7033c6122a82b26374e..c0225a83c2f1b9658172e4c517f0c7605a616e8f 100644 (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 ));
index 896729573b1e97a9bef980a8b5955ca925ac7b60..f947dff613a02ca84fa5cb2b08e95ad116f05301 100644 (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);