]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Make DatumGetInetP() unpack inet datums with a 1-byte header, and add
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 8 Nov 2011 20:39:43 +0000 (22:39 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 8 Nov 2011 20:45:36 +0000 (22:45 +0200)
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.

src/backend/utils/adt/network.c
src/include/utils/inet.h

index 9a45bcbd290ffcebb0ef325543cd15ea70836b04..3c1cc46a7ec6dfac44b9588c86b03e8675ffe8cf 100644 (file)
@@ -929,7 +929,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;
index 5b7b619dc7e7a8e213df7ac4dc1c0594d41a9777..80b902f30e6ade6d7f4aff44f6b46f254b5c095f 100644 (file)
@@ -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))