Datum UDT_send(UDT udt, PG_FUNCTION_ARGS) { StringInfoData buf; int32 dataLen = Type_getLength((Type)udt); if(!UDT_isScalar(udt)) ereport(ERROR, ( errcode(ERRCODE_CANNOT_COERCE), errmsg("UDT with Oid %d is not scalar", Type_getOid((Type)udt)))); if(dataLen == -1) return byteasend(fcinfo); if(dataLen == -2) return unknownsend(fcinfo); pq_begintypsend(&buf); appendBinaryStringInfo(&buf, PG_GETARG_POINTER(0), dataLen); PG_RETURN_BYTEA_P(pq_endtypsend(&buf)); }
/* * pg_ndistinct_send * binary output routine for type pg_ndistinct * * n-distinct is serialized into a bytea value, so let's send that. */ Datum pg_ndistinct_send(PG_FUNCTION_ARGS) { return byteasend(fcinfo); }
/* * pg_dependencies_send - binary output routine for type pg_dependencies. * * Functional dependencies are serialized in a bytea value (although the type * is named differently), so let's just send that. */ Datum pg_dependencies_send(PG_FUNCTION_ARGS) { return byteasend(fcinfo); }