aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/mac.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-12-08 23:57:03 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-12-08 23:57:03 +0000
commit376784cf8ac7dee831471d7fd4159145d135636b (patch)
tree62008e893458d778777a871f672c5545d5c9b241 /src/backend/utils/adt/mac.c
parentfb47385fc8d2314dd7d23d691959c882ead1c31a (diff)
downloadpostgresql-376784cf8ac7dee831471d7fd4159145d135636b.tar.gz
postgresql-376784cf8ac7dee831471d7fd4159145d135636b.zip
Repair erroneous use of hashvarlena() for MACADDR, which is not a
varlena type. (I did not force initdb, but you won't see the fix unless you do one.) Also, make sure all index support operators and functions are careful not to leak memory for toasted inputs; I had missed some hash and rtree support ops on this point before.
Diffstat (limited to 'src/backend/utils/adt/mac.c')
-rw-r--r--src/backend/utils/adt/mac.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/backend/utils/adt/mac.c b/src/backend/utils/adt/mac.c
index 5e949ea2e6e..17754588e97 100644
--- a/src/backend/utils/adt/mac.c
+++ b/src/backend/utils/adt/mac.c
@@ -1,11 +1,12 @@
/*
* PostgreSQL type definitions for MAC addresses.
*
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/mac.c,v 1.18 2000/08/23 06:04:33 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/mac.c,v 1.19 2000/12/08 23:57:03 tgl Exp $
*/
#include "postgres.h"
+#include "access/hash.h"
#include "utils/builtins.h"
#include "utils/inet.h"
@@ -237,10 +238,20 @@ macaddr_ne(PG_FUNCTION_ARGS)
}
/*
+ * Support function for hash indexes on macaddr.
+ */
+Datum
+hashmacaddr(PG_FUNCTION_ARGS)
+{
+ macaddr *key = PG_GETARG_MACADDR_P(0);
+
+ return hash_any((char *) key, sizeof(macaddr));
+}
+
+/*
* Truncation function to allow comparing mac manufacturers.
* From suggestion by Alex Pilosov <alex@pilosoft.com>
*/
-
Datum
macaddr_trunc(PG_FUNCTION_ARGS)
{