From c590273fef87321b12ea56733d6bf49a66841431 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 19 Jun 2000 03:55:01 +0000 Subject: 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. --- src/backend/utils/adt/timestamp.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/backend/utils/adt/timestamp.c') 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 #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 -- cgit v1.2.3