1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-29 10:41:53 +03:00

Make DatumGetInetP() unpack inet datums with a 1-byte header, and add

a new macro, DatumGetInetPP(), that does not. This brings these macros
in line with other DatumGet*P() macros.

Backpatch to 8.3, where 1-byte header varlenas were introduced.
This commit is contained in:
Heikki Linnakangas
2011-11-08 22:39:43 +02:00
parent 23998fe99c
commit 61f4750bf8
2 changed files with 4 additions and 2 deletions

View File

@ -907,7 +907,7 @@ convert_network_to_scalar(Datum value, Oid typid)
case INETOID: case INETOID:
case CIDROID: case CIDROID:
{ {
inet *ip = DatumGetInetP(value); inet *ip = DatumGetInetPP(value);
int len; int len;
double res; double res;
int i; int i;

View File

@ -70,9 +70,11 @@ typedef struct macaddr
/* /*
* fmgr interface macros * 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 InetPGetDatum(X) PointerGetDatum(X)
#define PG_GETARG_INET_P(n) DatumGetInetP(PG_GETARG_DATUM(n)) #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) #define PG_RETURN_INET_P(x) return InetPGetDatum(x)
/* macaddr is a fixed-length pass-by-reference datatype */ /* macaddr is a fixed-length pass-by-reference datatype */
#define DatumGetMacaddrP(X) ((macaddr *) DatumGetPointer(X)) #define DatumGetMacaddrP(X) ((macaddr *) DatumGetPointer(X))