mirror of
https://github.com/postgres/postgres.git
synced 2025-07-20 05:03:10 +03:00
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.
This commit is contained in:
@ -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"
|
||||
|
||||
@ -236,11 +237,21 @@ macaddr_ne(PG_FUNCTION_ARGS)
|
||||
PG_RETURN_BOOL(macaddr_cmp_internal(a1, a2) != 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user