aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/date.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/date.c
parenta53dc5ee613e6b6aa692b79b60adda86e026971c (diff)
downloadpostgresql-c590273fef87321b12ea56733d6bf49a66841431.tar.gz
postgresql-c590273fef87321b12ea56733d6bf49a66841431.zip
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/date.c')
-rw-r--r--src/backend/utils/adt/date.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c
index 128216f2b84..952a8e6d4d6 100644
--- a/src/backend/utils/adt/date.c
+++ b/src/backend/utils/adt/date.c
@@ -8,23 +8,27 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.47 2000/06/15 04:10:23 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.48 2000/06/19 03:54:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
-#include <limits.h>
-#include <time.h>
#include "postgres.h"
+
+#include <limits.h>
+#include <time.h>
#ifdef HAVE_FLOAT_H
#include <float.h>
#endif
+
+#include "access/hash.h"
#include "miscadmin.h"
#include "utils/date.h"
#include "utils/nabstime.h"
-static int
- date2tm(DateADT dateVal, int *tzp, struct tm * tm, double *fsec, char **tzn);
+
+static int date2tm(DateADT dateVal, int *tzp, struct tm * tm,
+ double *fsec, char **tzn);
/*****************************************************************************
@@ -762,6 +766,22 @@ timetz_cmp(PG_FUNCTION_ARGS)
PG_RETURN_INT32(0);
}
+/*
+ * timetz, being an unusual size, needs a specialized hash function.
+ */
+Datum
+timetz_hash(PG_FUNCTION_ARGS)
+{
+ TimeTzADT *key = PG_GETARG_TIMETZADT_P(0);
+
+ /*
+ * Specify hash length as sizeof(double) + sizeof(int4), not as
+ * sizeof(TimeTzADT), 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));
+}
+
Datum
timetz_larger(PG_FUNCTION_ARGS)
{