OSDN Git Service

More binary I/O routines.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 13 May 2003 18:03:08 +0000 (18:03 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 13 May 2003 18:03:08 +0000 (18:03 +0000)
src/backend/utils/adt/cash.c
src/backend/utils/adt/geo_ops.c
src/backend/utils/adt/mac.c
src/backend/utils/adt/network.c
src/backend/utils/adt/pseudotypes.c
src/include/catalog/catversion.h
src/include/catalog/pg_proc.h
src/include/catalog/pg_type.h
src/include/utils/builtins.h
src/include/utils/cash.h
src/include/utils/geo_decls.h

index f210f42..4a4e131 100644 (file)
@@ -9,7 +9,7 @@
  * workings can be found in the book "Software Solutions in C" by
  * Dale Schumacher, Academic Press, ISBN: 0-12-632360-7.
  *
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/cash.c,v 1.57 2003/03/11 21:01:33 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/cash.c,v 1.58 2003/05/13 18:03:07 tgl Exp $
  */
 
 #include "postgres.h"
@@ -19,6 +19,7 @@
 #include <math.h>
 #include <locale.h>
 
+#include "libpq/pqformat.h"
 #include "miscadmin.h"
 #include "utils/builtins.h"
 #include "utils/cash.h"
@@ -310,6 +311,31 @@ cash_out(PG_FUNCTION_ARGS)
        PG_RETURN_CSTRING(result);
 }
 
+/*
+ *             cash_recv                       - converts external binary format to cash
+ */
+Datum
+cash_recv(PG_FUNCTION_ARGS)
+{
+       StringInfo      buf = (StringInfo) PG_GETARG_POINTER(0);
+
+       PG_RETURN_CASH((Cash) pq_getmsgint(buf, sizeof(Cash)));
+}
+
+/*
+ *             cash_send                       - converts cash to binary format
+ */
+Datum
+cash_send(PG_FUNCTION_ARGS)
+{
+       Cash            arg1 = PG_GETARG_CASH(0);
+       StringInfoData buf;
+
+       pq_begintypsend(&buf);
+       pq_sendint(&buf, arg1, sizeof(Cash));
+       PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
+}
+
 
 Datum
 cash_eq(PG_FUNCTION_ARGS)
index 956bd17..1412a1c 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.76 2003/05/09 21:19:49 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.77 2003/05/13 18:03:07 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -409,6 +409,58 @@ box_out(PG_FUNCTION_ARGS)
        PG_RETURN_CSTRING(path_encode(-1, 2, &(box->high)));
 }
 
+/*
+ *             box_recv                        - converts external binary format to box
+ */
+Datum
+box_recv(PG_FUNCTION_ARGS)
+{
+       StringInfo      buf = (StringInfo) PG_GETARG_POINTER(0);
+       BOX                *box;
+       double          x,
+                               y;
+
+       box = (BOX *) palloc(sizeof(BOX));
+
+       box->high.x = pq_getmsgfloat8(buf);
+       box->high.y = pq_getmsgfloat8(buf);
+       box->low.x = pq_getmsgfloat8(buf);
+       box->low.y = pq_getmsgfloat8(buf);
+
+       /* reorder corners if necessary... */
+       if (box->high.x < box->low.x)
+       {
+               x = box->high.x;
+               box->high.x = box->low.x;
+               box->low.x = x;
+       }
+       if (box->high.y < box->low.y)
+       {
+               y = box->high.y;
+               box->high.y = box->low.y;
+               box->low.y = y;
+       }
+
+       PG_RETURN_BOX_P(box);
+}
+
+/*
+ *             box_send                        - converts box to binary format
+ */
+Datum
+box_send(PG_FUNCTION_ARGS)
+{
+       BOX                *box = PG_GETARG_BOX_P(0);
+       StringInfoData buf;
+
+       pq_begintypsend(&buf);
+       pq_sendfloat8(&buf, box->high.x);
+       pq_sendfloat8(&buf, box->high.y);
+       pq_sendfloat8(&buf, box->low.x);
+       pq_sendfloat8(&buf, box->low.y);
+       PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
+}
+
 
 /*             box_construct   -               fill in a new box.
  */
@@ -915,6 +967,26 @@ line_out(PG_FUNCTION_ARGS)
        PG_RETURN_CSTRING(result);
 }
 
+/*
+ *             line_recv                       - converts external binary format to line
+ */
+Datum
+line_recv(PG_FUNCTION_ARGS)
+{
+       elog(ERROR, "line not yet implemented");
+       return 0;
+}
+
+/*
+ *             line_send                       - converts line to binary format
+ */
+Datum
+line_send(PG_FUNCTION_ARGS)
+{
+       elog(ERROR, "line not yet implemented");
+       return 0;
+}
+
 
 /*----------------------------------------------------------
  *     Conversion routines from one line formula to internal.
@@ -1271,6 +1343,64 @@ path_out(PG_FUNCTION_ARGS)
        PG_RETURN_CSTRING(path_encode(path->closed, path->npts, path->p));
 }
 
+/*
+ *             path_recv                       - converts external binary format to path
+ *
+ * External representation is closed flag (a boolean byte), int32 number
+ * of points, and the points.
+ */
+Datum
+path_recv(PG_FUNCTION_ARGS)
+{
+       StringInfo      buf = (StringInfo) PG_GETARG_POINTER(0);
+       PATH       *path;
+       int                     closed;
+       int32           npts;
+       int32           i;
+       int                     size;
+
+       closed = pq_getmsgbyte(buf);
+       npts = pq_getmsgint(buf, sizeof(int32));
+       if (npts < 0 || npts >= (int32) (INT_MAX / sizeof(Point)))
+               elog(ERROR, "Invalid number of points in external path");
+
+       size = offsetof(PATH, p[0]) +sizeof(path->p[0]) * npts;
+       path = (PATH *) palloc(size);
+
+       path->size = size;
+       path->npts = npts;
+       path->closed = (closed ? 1 : 0);
+
+       for (i = 0; i < npts; i++)
+       {
+               path->p[i].x = pq_getmsgfloat8(buf);
+               path->p[i].y = pq_getmsgfloat8(buf);
+       }
+
+       PG_RETURN_PATH_P(path);
+}
+
+/*
+ *             path_send                       - converts path to binary format
+ */
+Datum
+path_send(PG_FUNCTION_ARGS)
+{
+       PATH       *path = PG_GETARG_PATH_P(0);
+       StringInfoData buf;
+       int32           i;
+
+       pq_begintypsend(&buf);
+       pq_sendbyte(&buf, path->closed ? 1 : 0);
+       pq_sendint(&buf, path->npts, sizeof(int32));
+       for (i = 0; i < path->npts; i++)
+       {
+               pq_sendfloat8(&buf, path->p[i].x);
+               pq_sendfloat8(&buf, path->p[i].y);
+       }
+       PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
+}
+
 
 /*----------------------------------------------------------
  *     Relational operators.
@@ -1815,6 +1945,46 @@ lseg_out(PG_FUNCTION_ARGS)
        PG_RETURN_CSTRING(path_encode(FALSE, 2, (Point *) &(ls->p[0])));
 }
 
+/*
+ *             lseg_recv                       - converts external binary format to lseg
+ */
+Datum
+lseg_recv(PG_FUNCTION_ARGS)
+{
+       StringInfo      buf = (StringInfo) PG_GETARG_POINTER(0);
+       LSEG       *lseg;
+
+       lseg = (LSEG *) palloc(sizeof(LSEG));
+
+       lseg->p[0].x = pq_getmsgfloat8(buf);
+       lseg->p[0].y = pq_getmsgfloat8(buf);
+       lseg->p[1].x = pq_getmsgfloat8(buf);
+       lseg->p[1].y = pq_getmsgfloat8(buf);
+
+#ifdef NOT_USED
+       lseg->m = point_sl(&lseg->p[0], &lseg->p[1]);
+#endif
+
+       PG_RETURN_LSEG_P(lseg);
+}
+
+/*
+ *             lseg_send                       - converts lseg to binary format
+ */
+Datum
+lseg_send(PG_FUNCTION_ARGS)
+{
+       LSEG       *ls = PG_GETARG_LSEG_P(0);
+       StringInfoData buf;
+
+       pq_begintypsend(&buf);
+       pq_sendfloat8(&buf, ls->p[0].x);
+       pq_sendfloat8(&buf, ls->p[0].y);
+       pq_sendfloat8(&buf, ls->p[1].x);
+       pq_sendfloat8(&buf, ls->p[1].y);
+       PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
+}
+
 
 /* lseg_construct -
  *             form a LSEG from two Points.
@@ -3186,6 +3356,64 @@ poly_out(PG_FUNCTION_ARGS)
        PG_RETURN_CSTRING(path_encode(TRUE, poly->npts, poly->p));
 }
 
+/*
+ *             poly_recv                       - converts external binary format to polygon
+ *
+ * External representation is int32 number of points, and the points.
+ * We recompute the bounding box on read, instead of trusting it to
+ * be valid.  (Checking it would take just as long, so may as well
+ * omit it from external representation.)
+ */
+Datum
+poly_recv(PG_FUNCTION_ARGS)
+{
+       StringInfo      buf = (StringInfo) PG_GETARG_POINTER(0);
+       POLYGON    *poly;
+       int32           npts;
+       int32           i;
+       int                     size;
+
+       npts = pq_getmsgint(buf, sizeof(int32));
+       if (npts < 0 || npts >= (int32) ((INT_MAX - offsetof(POLYGON, p[0])) / sizeof(Point)))
+               elog(ERROR, "Invalid number of points in external polygon");
+
+       size = offsetof(POLYGON, p[0]) +sizeof(poly->p[0]) * npts;
+       poly = (POLYGON *) palloc0(size);       /* zero any holes */
+
+       poly->size = size;
+       poly->npts = npts;
+
+       for (i = 0; i < npts; i++)
+       {
+               poly->p[i].x = pq_getmsgfloat8(buf);
+               poly->p[i].y = pq_getmsgfloat8(buf);
+       }
+
+       make_bound_box(poly);
+
+       PG_RETURN_POLYGON_P(poly);
+}
+
+/*
+ *             poly_send                       - converts polygon to binary format
+ */
+Datum
+poly_send(PG_FUNCTION_ARGS)
+{
+       POLYGON    *poly = PG_GETARG_POLYGON_P(0);
+       StringInfoData buf;
+       int32           i;
+
+       pq_begintypsend(&buf);
+       pq_sendint(&buf, poly->npts, sizeof(int32));
+       for (i = 0; i < poly->npts; i++)
+       {
+               pq_sendfloat8(&buf, poly->p[i].x);
+               pq_sendfloat8(&buf, poly->p[i].y);
+       }
+       PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
+}
+
 
 /*-------------------------------------------------------
  * Is polygon A strictly left of polygon B? i.e. is
@@ -4001,6 +4229,43 @@ circle_out(PG_FUNCTION_ARGS)
        PG_RETURN_CSTRING(result);
 }
 
+/*
+ *             circle_recv                     - converts external binary format to circle
+ */
+Datum
+circle_recv(PG_FUNCTION_ARGS)
+{
+       StringInfo      buf = (StringInfo) PG_GETARG_POINTER(0);
+       CIRCLE     *circle;
+
+       circle = (CIRCLE *) palloc(sizeof(CIRCLE));
+
+       circle->center.x = pq_getmsgfloat8(buf);
+       circle->center.y = pq_getmsgfloat8(buf);
+       circle->radius = pq_getmsgfloat8(buf);
+
+       if (circle->radius < 0)
+               elog(ERROR, "Invalid radius in external circle");
+
+       PG_RETURN_CIRCLE_P(circle);
+}
+
+/*
+ *             circle_send                     - converts circle to binary format
+ */
+Datum
+circle_send(PG_FUNCTION_ARGS)
+{
+       CIRCLE     *circle = PG_GETARG_CIRCLE_P(0);
+       StringInfoData buf;
+
+       pq_begintypsend(&buf);
+       pq_sendfloat8(&buf, circle->center.x);
+       pq_sendfloat8(&buf, circle->center.y);
+       pq_sendfloat8(&buf, circle->radius);
+       PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
+}
+
 
 /*----------------------------------------------------------
  *     Relational operators for CIRCLEs.
index ba15342..01111e3 100644 (file)
@@ -1,15 +1,17 @@
 /*
  *     PostgreSQL type definitions for MAC addresses.
  *
- *     $Header: /cvsroot/pgsql/src/backend/utils/adt/mac.c,v 1.27 2002/10/13 15:39:17 tgl Exp $
+ *     $Header: /cvsroot/pgsql/src/backend/utils/adt/mac.c,v 1.28 2003/05/13 18:03:07 tgl Exp $
  */
 
 #include "postgres.h"
 
 #include "access/hash.h"
+#include "libpq/pqformat.h"
 #include "utils/builtins.h"
 #include "utils/inet.h"
 
+
 /*
  *     Utility macros used for sorting and comparing:
  */
@@ -96,6 +98,49 @@ macaddr_out(PG_FUNCTION_ARGS)
 }
 
 /*
+ *             macaddr_recv                    - converts external binary format to macaddr
+ *
+ * The external representation is just the six bytes, MSB first.
+ */
+Datum
+macaddr_recv(PG_FUNCTION_ARGS)
+{
+       StringInfo      buf = (StringInfo) PG_GETARG_POINTER(0);
+       macaddr    *addr;
+
+       addr = (macaddr *) palloc(sizeof(macaddr));
+
+       addr->a = pq_getmsgbyte(buf);
+       addr->b = pq_getmsgbyte(buf);
+       addr->c = pq_getmsgbyte(buf);
+       addr->d = pq_getmsgbyte(buf);
+       addr->e = pq_getmsgbyte(buf);
+       addr->f = pq_getmsgbyte(buf);
+
+       PG_RETURN_MACADDR_P(addr);
+}
+
+/*
+ *             macaddr_send                    - converts macaddr to binary format
+ */
+Datum
+macaddr_send(PG_FUNCTION_ARGS)
+{
+       macaddr    *addr = PG_GETARG_MACADDR_P(0);
+       StringInfoData buf;
+
+       pq_begintypsend(&buf);
+       pq_sendbyte(&buf, addr->a);
+       pq_sendbyte(&buf, addr->b);
+       pq_sendbyte(&buf, addr->c);
+       pq_sendbyte(&buf, addr->d);
+       pq_sendbyte(&buf, addr->e);
+       pq_sendbyte(&buf, addr->f);
+       PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
+}
+
+
+/*
  * Convert macaddr to text data type.
  */
 
index d814f96..3bc645c 100644 (file)
@@ -3,7 +3,7 @@
  *     is for IP V4 CIDR notation, but prepared for V6: just
  *     add the necessary bits where the comments indicate.
  *
- *     $Header: /cvsroot/pgsql/src/backend/utils/adt/network.c,v 1.40 2003/03/21 23:18:52 tgl Exp $
+ *     $Header: /cvsroot/pgsql/src/backend/utils/adt/network.c,v 1.41 2003/05/13 18:03:07 tgl Exp $
  *
  *     Jon Postel RIP 16 Oct 1998
  */
@@ -16,6 +16,7 @@
 #include <arpa/inet.h>
 
 #include "catalog/pg_type.h"
+#include "libpq/pqformat.h"
 #include "utils/builtins.h"
 #include "utils/inet.h"
 
@@ -148,6 +149,101 @@ cidr_out(PG_FUNCTION_ARGS)
 }
 
 
+/*
+ *             inet_recv                       - converts external binary format to inet
+ *
+ * The external representation is (one byte apiece for)
+ * family, bits, type, address length, address in network byte order.
+ */
+Datum
+inet_recv(PG_FUNCTION_ARGS)
+{
+       StringInfo      buf = (StringInfo) PG_GETARG_POINTER(0);
+       inet       *addr;
+       char       *addrptr;
+       int                     bits;
+       int                     nb,
+                               i;
+
+       /* make sure any unused bits in a CIDR value are zeroed */
+       addr = (inet *) palloc0(VARHDRSZ + sizeof(inet_struct));
+
+       ip_family(addr) = pq_getmsgbyte(buf);
+       if (ip_family(addr) != AF_INET)
+               elog(ERROR, "Invalid family in external inet");
+       bits = pq_getmsgbyte(buf);
+       if (bits < 0 || bits > 32)
+               elog(ERROR, "Invalid bits in external inet");
+       ip_bits(addr) = bits;
+       ip_type(addr) = pq_getmsgbyte(buf);
+       if (ip_type(addr) != 0 && ip_type(addr) != 1)
+               elog(ERROR, "Invalid type in external inet");
+       nb = pq_getmsgbyte(buf);
+       if (nb != ip_addrsize(addr))
+               elog(ERROR, "Invalid length in external inet");
+
+       VARATT_SIZEP(addr) = VARHDRSZ
+               + ((char *) &ip_v4addr(addr) - (char *) VARDATA(addr))
+               + ip_addrsize(addr);
+
+       addrptr = (char *) &ip_v4addr(addr);
+       for (i = 0; i < nb; i++)
+               addrptr[i] = pq_getmsgbyte(buf);
+
+       /*
+        * Error check: CIDR values must not have any bits set beyond the
+        * masklen. XXX this code is not IPV6 ready.
+        */
+       if (ip_type(addr))
+       {
+               if (!v4addressOK(ip_v4addr(addr), bits))
+                       elog(ERROR, "invalid external CIDR value: has bits set to right of mask");
+       }
+
+       PG_RETURN_INET_P(addr);
+}
+
+/* share code with INET case */
+Datum
+cidr_recv(PG_FUNCTION_ARGS)
+{
+       return inet_recv(fcinfo);
+}
+
+/*
+ *             inet_send                       - converts inet to binary format
+ */
+Datum
+inet_send(PG_FUNCTION_ARGS)
+{
+       inet       *addr = PG_GETARG_INET_P(0);
+       StringInfoData buf;
+       char       *addrptr;
+       int                     nb,
+                               i;
+
+       pq_begintypsend(&buf);
+       pq_sendbyte(&buf, ip_family(addr));
+       pq_sendbyte(&buf, ip_bits(addr));
+       pq_sendbyte(&buf, ip_type(addr));
+       nb = ip_addrsize(addr);
+       if (nb < 0)
+               nb = 0;
+       pq_sendbyte(&buf, nb);
+       addrptr = (char *) &ip_v4addr(addr);
+       for (i = 0; i < nb; i++)
+               pq_sendbyte(&buf, addrptr[i]);
+       PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
+}
+
+/* share code with INET case */
+Datum
+cidr_send(PG_FUNCTION_ARGS)
+{
+       return inet_send(fcinfo);
+}
+
+
 static Datum
 text_network(text *src, int type)
 {
index 59b3185..1a997ed 100644 (file)
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/pseudotypes.c,v 1.6 2003/05/08 22:19:56 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/pseudotypes.c,v 1.7 2003/05/13 18:03:07 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include "postgres.h"
 
+#include "libpq/pqformat.h"
 #include "utils/array.h"
 #include "utils/builtins.h"
 
@@ -54,7 +55,7 @@ record_out(PG_FUNCTION_ARGS)
 Datum
 record_recv(PG_FUNCTION_ARGS)
 {
-       elog(ERROR, "Cannot accept a constant of type %s", "RECORD");
+       elog(ERROR, "Cannot accept a value of type %s", "RECORD");
 
        PG_RETURN_VOID();                       /* keep compiler quiet */
 }
@@ -98,6 +99,34 @@ cstring_out(PG_FUNCTION_ARGS)
        PG_RETURN_CSTRING(pstrdup(str));
 }
 
+/*
+ * cstring_recv                - binary input routine for pseudo-type CSTRING.
+ */
+Datum
+cstring_recv(PG_FUNCTION_ARGS)
+{
+       StringInfo      buf = (StringInfo) PG_GETARG_POINTER(0);
+       char       *str;
+       int                     nbytes;
+
+       str = pq_getmsgtext(buf, buf->len - buf->cursor, &nbytes);
+       PG_RETURN_CSTRING(str);
+}
+
+/*
+ * cstring_send                - binary output routine for pseudo-type CSTRING.
+ */
+Datum
+cstring_send(PG_FUNCTION_ARGS)
+{
+       char       *str = PG_GETARG_CSTRING(0);
+       StringInfoData buf;
+
+       pq_begintypsend(&buf);
+       pq_sendtext(&buf, str, strlen(str));
+       PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
+}
+
 
 /*
  * any_in              - input routine for pseudo-type ANY.
@@ -144,6 +173,32 @@ anyarray_out(PG_FUNCTION_ARGS)
        return array_out(fcinfo);
 }
 
+/*
+ * anyarray_recv               - binary input routine for pseudo-type ANYARRAY.
+ *
+ * XXX this could actually be made to work, since the incoming array
+ * data will contain the element type OID.  Need to think through
+ * type-safety issues before allowing it, however.
+ */
+Datum
+anyarray_recv(PG_FUNCTION_ARGS)
+{
+       elog(ERROR, "Cannot accept a value of type %s", "ANYARRAY");
+
+       PG_RETURN_VOID();                       /* keep compiler quiet */
+}
+
+/*
+ * anyarray_send               - binary output routine for pseudo-type ANYARRAY.
+ *
+ * We may as well allow this, since array_send will in fact work.
+ */
+Datum
+anyarray_send(PG_FUNCTION_ARGS)
+{
+       return array_send(fcinfo);
+}
+
 
 /*
  * void_in             - input routine for pseudo-type VOID.
index 4a53837..bb4b824 100644 (file)
@@ -37,7 +37,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: catversion.h,v 1.192 2003/05/13 04:38:58 tgl Exp $
+ * $Id: catversion.h,v 1.193 2003/05/13 18:03:07 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -53,6 +53,6 @@
  */
 
 /*                                                     yyyymmddN */
-#define CATALOG_VERSION_NO     200305122
+#define CATALOG_VERSION_NO     200305131
 
 #endif
index bb8e01e..33513ad 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_proc.h,v 1.298 2003/05/12 23:08:51 tgl Exp $
+ * $Id: pg_proc.h,v 1.299 2003/05/13 18:03:07 tgl Exp $
  *
  * NOTES
  *       The script catalog/genbki.sh reads this file and generates .bki
@@ -3313,6 +3313,54 @@ DATA(insert OID = 2478 (  interval_recv             PGNSP PGUID 12 f f t f i 1 1186 "228
 DESCR("I/O");
 DATA(insert OID = 2479 (  interval_send                   PGNSP PGUID 12 f f t f i 1 17 "1186"  interval_send - _null_ ));
 DESCR("I/O");
+DATA(insert OID = 2480 (  lseg_recv                       PGNSP PGUID 12 f f t f i 1 601 "2281"  lseg_recv - _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2481 (  lseg_send                       PGNSP PGUID 12 f f t f i 1 17 "601"  lseg_send - _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2482 (  path_recv                       PGNSP PGUID 12 f f t f i 1 602 "2281"  path_recv - _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2483 (  path_send                       PGNSP PGUID 12 f f t f i 1 17 "602"  path_send - _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2484 (  box_recv                        PGNSP PGUID 12 f f t f i 1 603 "2281"  box_recv - _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2485 (  box_send                        PGNSP PGUID 12 f f t f i 1 17 "603"  box_send - _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2486 (  poly_recv                       PGNSP PGUID 12 f f t f i 1 604 "2281"  poly_recv - _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2487 (  poly_send                       PGNSP PGUID 12 f f t f i 1 17 "604"  poly_send - _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2488 (  line_recv                       PGNSP PGUID 12 f f t f i 1 628 "2281"  line_recv - _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2489 (  line_send                       PGNSP PGUID 12 f f t f i 1 17 "628"  line_send - _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2490 (  circle_recv             PGNSP PGUID 12 f f t f i 1 718 "2281"  circle_recv - _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2491 (  circle_send             PGNSP PGUID 12 f f t f i 1 17 "718"  circle_send - _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2492 (  cash_recv                       PGNSP PGUID 12 f f t f i 1 790 "2281"  cash_recv - _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2493 (  cash_send                       PGNSP PGUID 12 f f t f i 1 17 "790"  cash_send - _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2494 (  macaddr_recv            PGNSP PGUID 12 f f t f i 1 829 "2281"  macaddr_recv - _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2495 (  macaddr_send            PGNSP PGUID 12 f f t f i 1 17 "829"  macaddr_send - _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2496 (  inet_recv                       PGNSP PGUID 12 f f t f i 1 869 "2281"  inet_recv - _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2497 (  inet_send                       PGNSP PGUID 12 f f t f i 1 17 "869"  inet_send - _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2498 (  cidr_recv                       PGNSP PGUID 12 f f t f i 1 650 "2281"  cidr_recv - _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2499 (  cidr_send                       PGNSP PGUID 12 f f t f i 1 17 "650"  cidr_send - _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2500 (  cstring_recv            PGNSP PGUID 12 f f t f s 1 2275 "2281"  cstring_recv - _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2501 (  cstring_send            PGNSP PGUID 12 f f t f s 1 17 "2275"  cstring_send - _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2502 (  anyarray_recv                   PGNSP PGUID 12 f f t f s 1 2277 "2281"  anyarray_recv - _null_ ));
+DESCR("I/O");
+DATA(insert OID = 2503 (  anyarray_send                   PGNSP PGUID 12 f f t f s 1 17 "2277"  anyarray_send - _null_ ));
+DESCR("I/O");
 
 
 /*
index 46ed403..2b4e51c 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_type.h,v 1.144 2003/05/12 23:08:51 tgl Exp $
+ * $Id: pg_type.h,v 1.145 2003/05/13 18:03:08 tgl Exp $
  *
  * NOTES
  *       the genbki.sh script reads this file and generates .bki
@@ -326,20 +326,20 @@ DESCR("storage manager");
 DATA(insert OID = 600 (  point    PGNSP PGUID 16 f b t \054 0 701 point_in point_out point_recv point_send d p f 0 -1 0 _null_ _null_ ));
 DESCR("geometric point '(x, y)'");
 #define POINTOID               600
-DATA(insert OID = 601 (  lseg     PGNSP PGUID 32 f b t \054 0 600 lseg_in lseg_out - - d p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 601 (  lseg     PGNSP PGUID 32 f b t \054 0 600 lseg_in lseg_out lseg_recv lseg_send d p f 0 -1 0 _null_ _null_ ));
 DESCR("geometric line segment '(pt1,pt2)'");
 #define LSEGOID                        601
-DATA(insert OID = 602 (  path     PGNSP PGUID -1 f b t \054 0 0 path_in path_out - - d x f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 602 (  path     PGNSP PGUID -1 f b t \054 0 0 path_in path_out path_recv path_send d x f 0 -1 0 _null_ _null_ ));
 DESCR("geometric path '(pt1,...)'");
 #define PATHOID                        602
-DATA(insert OID = 603 (  box      PGNSP PGUID 32 f b t \073 0 600 box_in box_out - - d p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 603 (  box      PGNSP PGUID 32 f b t \073 0 600 box_in box_out box_recv box_send d p f 0 -1 0 _null_ _null_ ));
 DESCR("geometric box '(lower left,upper right)'");
 #define BOXOID                 603
-DATA(insert OID = 604 (  polygon   PGNSP PGUID -1 f b t \054 0  0 poly_in poly_out - - d x f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 604 (  polygon   PGNSP PGUID -1 f b t \054 0  0 poly_in poly_out poly_recv poly_send d x f 0 -1 0 _null_ _null_ ));
 DESCR("geometric polygon '(pt1,...)'");
 #define POLYGONOID             604
 
-DATA(insert OID = 628 (  line     PGNSP PGUID 32 f b t \054 0 701 line_in line_out - - d p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 628 (  line     PGNSP PGUID 32 f b t \054 0 701 line_in line_out line_recv line_send d p f 0 -1 0 _null_ _null_ ));
 DESCR("geometric line (not implemented)'");
 #define LINEOID                        628
 DATA(insert OID = 629 (  _line    PGNSP PGUID  -1 f b t \054 0 628 array_in array_out array_recv array_send d x f 0 -1 0 _null_ _null_ ));
@@ -366,23 +366,23 @@ DATA(insert OID = 705 (  unknown   PGNSP PGUID -1 f b t \054 0     0 unknownin unkn
 DESCR("");
 #define UNKNOWNOID             705
 
-DATA(insert OID = 718 (  circle    PGNSP PGUID 24 f b t \054 0 0 circle_in circle_out - - d p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 718 (  circle    PGNSP PGUID 24 f b t \054 0 0 circle_in circle_out circle_recv circle_send d p f 0 -1 0 _null_ _null_ ));
 DESCR("geometric circle '(center,radius)'");
 #define CIRCLEOID              718
 DATA(insert OID = 719 (  _circle   PGNSP PGUID -1 f b t \054 0  718 array_in array_out array_recv array_send d x f 0 -1 0 _null_ _null_ ));
-DATA(insert OID = 790 (  money    PGNSP PGUID   4 f b t \054 0 0 cash_in cash_out - - i p f 0 -1 0 _null_ _null_ ));
-DESCR("$d,ddd.cc, money");
+DATA(insert OID = 790 (  money    PGNSP PGUID   4 f b t \054 0 0 cash_in cash_out cash_recv cash_send i p f 0 -1 0 _null_ _null_ ));
+DESCR("monetary amounts, $d,ddd.cc");
 #define CASHOID 790
 DATA(insert OID = 791 (  _money    PGNSP PGUID -1 f b t \054 0  790 array_in array_out array_recv array_send i x f 0 -1 0 _null_ _null_ ));
 
 /* OIDS 800 - 899 */
-DATA(insert OID = 829 ( macaddr    PGNSP PGUID 6 f b t \054 0 0 macaddr_in macaddr_out - - i p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 829 ( macaddr    PGNSP PGUID 6 f b t \054 0 0 macaddr_in macaddr_out macaddr_recv macaddr_send i p f 0 -1 0 _null_ _null_ ));
 DESCR("XX:XX:XX:XX:XX:XX, MAC address");
 #define MACADDROID 829
-DATA(insert OID = 869 ( inet      PGNSP PGUID  -1 f b t \054 0 0 inet_in inet_out - - i p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 869 ( inet      PGNSP PGUID  -1 f b t \054 0 0 inet_in inet_out inet_recv inet_send i p f 0 -1 0 _null_ _null_ ));
 DESCR("IP address/netmask, host address, netmask optional");
 #define INETOID 869
-DATA(insert OID = 650 ( cidr      PGNSP PGUID  -1 f b t \054 0 0 cidr_in cidr_out - - i p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 650 ( cidr      PGNSP PGUID  -1 f b t \054 0 0 cidr_in cidr_out cidr_recv cidr_send i p f 0 -1 0 _null_ _null_ ));
 DESCR("network IP address/netmask, network address");
 #define CIDROID 650
 
@@ -521,11 +521,11 @@ DATA(insert OID = 2211 ( _regtype    PGNSP PGUID -1 f b t \054 0 2206 array_in a
  */
 DATA(insert OID = 2249 ( record                        PGNSP PGUID  4 t p t \054 0 0 record_in record_out record_recv record_send      i p f 0 -1 0 _null_ _null_ ));
 #define RECORDOID              2249
-DATA(insert OID = 2275 ( cstring               PGNSP PGUID -2 f p t \054 0 0 cstring_in cstring_out - -        c p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 2275 ( cstring               PGNSP PGUID -2 f p t \054 0 0 cstring_in cstring_out cstring_recv cstring_send  c p f 0 -1 0 _null_ _null_ ));
 #define CSTRINGOID             2275
 DATA(insert OID = 2276 ( any                   PGNSP PGUID  4 t p t \054 0 0 any_in any_out - -        i p f 0 -1 0 _null_ _null_ ));
 #define ANYOID                 2276
-DATA(insert OID = 2277 ( anyarray              PGNSP PGUID -1 f p t \054 0 0 anyarray_in anyarray_out - -      i x f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 2277 ( anyarray              PGNSP PGUID -1 f p t \054 0 0 anyarray_in anyarray_out anyarray_recv anyarray_send      i x f 0 -1 0 _null_ _null_ ));
 #define ANYARRAYOID            2277
 DATA(insert OID = 2278 ( void                  PGNSP PGUID  4 t p t \054 0 0 void_in void_out - -      i p f 0 -1 0 _null_ _null_ ));
 #define VOIDOID                        2278
index c7fae37..a86c9a9 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: builtins.h,v 1.215 2003/05/12 23:08:51 tgl Exp $
+ * $Id: builtins.h,v 1.216 2003/05/13 18:03:08 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -367,10 +367,14 @@ extern Datum record_recv(PG_FUNCTION_ARGS);
 extern Datum record_send(PG_FUNCTION_ARGS);
 extern Datum cstring_in(PG_FUNCTION_ARGS);
 extern Datum cstring_out(PG_FUNCTION_ARGS);
+extern Datum cstring_recv(PG_FUNCTION_ARGS);
+extern Datum cstring_send(PG_FUNCTION_ARGS);
 extern Datum any_in(PG_FUNCTION_ARGS);
 extern Datum any_out(PG_FUNCTION_ARGS);
 extern Datum anyarray_in(PG_FUNCTION_ARGS);
 extern Datum anyarray_out(PG_FUNCTION_ARGS);
+extern Datum anyarray_recv(PG_FUNCTION_ARGS);
+extern Datum anyarray_send(PG_FUNCTION_ARGS);
 extern Datum void_in(PG_FUNCTION_ARGS);
 extern Datum void_out(PG_FUNCTION_ARGS);
 extern Datum trigger_in(PG_FUNCTION_ARGS);
@@ -611,8 +615,12 @@ extern int inet_net_pton(int af, const char *src,
 /* network.c */
 extern Datum inet_in(PG_FUNCTION_ARGS);
 extern Datum inet_out(PG_FUNCTION_ARGS);
+extern Datum inet_recv(PG_FUNCTION_ARGS);
+extern Datum inet_send(PG_FUNCTION_ARGS);
 extern Datum cidr_in(PG_FUNCTION_ARGS);
 extern Datum cidr_out(PG_FUNCTION_ARGS);
+extern Datum cidr_recv(PG_FUNCTION_ARGS);
+extern Datum cidr_send(PG_FUNCTION_ARGS);
 extern Datum network_cmp(PG_FUNCTION_ARGS);
 extern Datum network_lt(PG_FUNCTION_ARGS);
 extern Datum network_le(PG_FUNCTION_ARGS);
@@ -642,6 +650,8 @@ extern Datum network_scan_last(Datum in);
 /* mac.c */
 extern Datum macaddr_in(PG_FUNCTION_ARGS);
 extern Datum macaddr_out(PG_FUNCTION_ARGS);
+extern Datum macaddr_recv(PG_FUNCTION_ARGS);
+extern Datum macaddr_send(PG_FUNCTION_ARGS);
 extern Datum macaddr_cmp(PG_FUNCTION_ARGS);
 extern Datum macaddr_lt(PG_FUNCTION_ARGS);
 extern Datum macaddr_le(PG_FUNCTION_ARGS);
index 02b6c64..305304c 100644 (file)
@@ -14,6 +14,8 @@ typedef int32 Cash;
 
 extern Datum cash_in(PG_FUNCTION_ARGS);
 extern Datum cash_out(PG_FUNCTION_ARGS);
+extern Datum cash_recv(PG_FUNCTION_ARGS);
+extern Datum cash_send(PG_FUNCTION_ARGS);
 
 extern Datum cash_eq(PG_FUNCTION_ARGS);
 extern Datum cash_ne(PG_FUNCTION_ARGS);
index 91cbe10..e062d82 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: geo_decls.h,v 1.39 2003/05/09 21:19:50 tgl Exp $
+ * $Id: geo_decls.h,v 1.40 2003/05/13 18:03:08 tgl Exp $
  *
  * NOTE
  *       These routines do *not* use the float types from adt/.
@@ -213,6 +213,8 @@ extern double point_sl(Point *pt1, Point *pt2);
 /* public lseg routines */
 extern Datum lseg_in(PG_FUNCTION_ARGS);
 extern Datum lseg_out(PG_FUNCTION_ARGS);
+extern Datum lseg_recv(PG_FUNCTION_ARGS);
+extern Datum lseg_send(PG_FUNCTION_ARGS);
 extern Datum lseg_intersect(PG_FUNCTION_ARGS);
 extern Datum lseg_parallel(PG_FUNCTION_ARGS);
 extern Datum lseg_perp(PG_FUNCTION_ARGS);
@@ -257,6 +259,8 @@ extern Datum inter_lb(PG_FUNCTION_ARGS);
 /* public line routines */
 extern Datum line_in(PG_FUNCTION_ARGS);
 extern Datum line_out(PG_FUNCTION_ARGS);
+extern Datum line_recv(PG_FUNCTION_ARGS);
+extern Datum line_send(PG_FUNCTION_ARGS);
 extern Datum line_interpt(PG_FUNCTION_ARGS);
 extern Datum line_distance(PG_FUNCTION_ARGS);
 extern Datum line_construct_pp(PG_FUNCTION_ARGS);
@@ -270,6 +274,8 @@ extern Datum line_eq(PG_FUNCTION_ARGS);
 /* public box routines */
 extern Datum box_in(PG_FUNCTION_ARGS);
 extern Datum box_out(PG_FUNCTION_ARGS);
+extern Datum box_recv(PG_FUNCTION_ARGS);
+extern Datum box_send(PG_FUNCTION_ARGS);
 extern Datum box_same(PG_FUNCTION_ARGS);
 extern Datum box_overlap(PG_FUNCTION_ARGS);
 extern Datum box_overleft(PG_FUNCTION_ARGS);
@@ -301,6 +307,8 @@ extern Datum box_div(PG_FUNCTION_ARGS);
 /* public path routines */
 extern Datum path_in(PG_FUNCTION_ARGS);
 extern Datum path_out(PG_FUNCTION_ARGS);
+extern Datum path_recv(PG_FUNCTION_ARGS);
+extern Datum path_send(PG_FUNCTION_ARGS);
 extern Datum path_n_lt(PG_FUNCTION_ARGS);
 extern Datum path_n_gt(PG_FUNCTION_ARGS);
 extern Datum path_n_eq(PG_FUNCTION_ARGS);
@@ -328,6 +336,8 @@ extern Datum path_poly(PG_FUNCTION_ARGS);
 /* public polygon routines */
 extern Datum poly_in(PG_FUNCTION_ARGS);
 extern Datum poly_out(PG_FUNCTION_ARGS);
+extern Datum poly_recv(PG_FUNCTION_ARGS);
+extern Datum poly_send(PG_FUNCTION_ARGS);
 extern Datum poly_left(PG_FUNCTION_ARGS);
 extern Datum poly_overleft(PG_FUNCTION_ARGS);
 extern Datum poly_right(PG_FUNCTION_ARGS);
@@ -348,6 +358,8 @@ extern Datum box_poly(PG_FUNCTION_ARGS);
 /* public circle routines */
 extern Datum circle_in(PG_FUNCTION_ARGS);
 extern Datum circle_out(PG_FUNCTION_ARGS);
+extern Datum circle_recv(PG_FUNCTION_ARGS);
+extern Datum circle_send(PG_FUNCTION_ARGS);
 extern Datum circle_same(PG_FUNCTION_ARGS);
 extern Datum circle_overlap(PG_FUNCTION_ARGS);
 extern Datum circle_overleft(PG_FUNCTION_ARGS);