summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/timestamp.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-06-19 03:55:01 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-06-19 03:55:01 +0000
commitc590273fef87321b12ea56733d6bf49a66841431 (patch)
treed8f7577ae236027aa9ca91eb6e1930574c956d4b /src/backend/utils/adt/timestamp.c
parenta53dc5ee613e6b6aa692b79b60adda86e026971c (diff)
Clean up bogosities in pg_opclass, pg_amop, pg_amproc. There are amproc
entries now for int8 and network hash indexes. int24_ops and int42_ops are gone. pg_opclass no longer contains multiple entries claiming to be the default opclass for the same datatype. opr_sanity regress test extended to catch errors like these in the future.
Diffstat (limited to 'src/backend/utils/adt/timestamp.c')
-rw-r--r--src/backend/utils/adt/timestamp.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c
index 7715942a28a..71549bb9256 100644
--- a/src/backend/utils/adt/timestamp.c
+++ b/src/backend/utils/adt/timestamp.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.29 2000/06/09 01:11:09 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.30 2000/06/19 03:54:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -29,6 +29,7 @@
#include <sys/timeb.h>
#endif
+#include "access/hash.h"
#include "access/xact.h"
#include "miscadmin.h"
#include "utils/builtins.h"
@@ -816,6 +817,22 @@ interval_cmp(PG_FUNCTION_ARGS)
PG_RETURN_INT32((span1 < span2) ? -1 : (span1 > span2) ? 1 : 0);
}
+/*
+ * interval, being an unusual size, needs a specialized hash function.
+ */
+Datum
+interval_hash(PG_FUNCTION_ARGS)
+{
+ Interval *key = PG_GETARG_INTERVAL_P(0);
+
+ /*
+ * Specify hash length as sizeof(double) + sizeof(int4), not as
+ * sizeof(Interval), so that any garbage pad bytes in the structure
+ * won't be included in the hash!
+ */
+ return hash_any((char *) key, sizeof(double) + sizeof(int4));
+}
+
/* overlaps_timestamp()
* Implements the SQL92 OVERLAPS operator.
* Algorithm from Date and Darwen, 1997