diff --git a/src/backend/utils/adt/network.c b/src/backend/utils/adt/network.c index a5aab28774..9a369a713f 100644 --- a/src/backend/utils/adt/network.c +++ b/src/backend/utils/adt/network.c @@ -907,7 +907,7 @@ convert_network_to_scalar(Datum value, Oid typid) case INETOID: case CIDROID: { - inet *ip = DatumGetInetP(value); + inet *ip = DatumGetInetPP(value); int len; double res; int i; diff --git a/src/include/utils/inet.h b/src/include/utils/inet.h index c1ead12360..945cc58038 100644 --- a/src/include/utils/inet.h +++ b/src/include/utils/inet.h @@ -70,9 +70,11 @@ typedef struct macaddr /* * fmgr interface macros */ -#define DatumGetInetP(X) ((inet *) PG_DETOAST_DATUM_PACKED(X)) +#define DatumGetInetP(X) ((inet *) PG_DETOAST_DATUM(X)) +#define DatumGetInetPP(X) ((inet *) PG_DETOAST_DATUM_PACKED(X)) #define InetPGetDatum(X) PointerGetDatum(X) #define PG_GETARG_INET_P(n) DatumGetInetP(PG_GETARG_DATUM(n)) +#define PG_GETARG_INET_PP(n) DatumGetInetP(PG_GETARG_DATUM_PACKED(n)) #define PG_RETURN_INET_P(x) return InetPGetDatum(x) /* macaddr is a fixed-length pass-by-reference datatype */ #define DatumGetMacaddrP(X) ((macaddr *) DatumGetPointer(X))