2007-10-12_22:22:32-0400 Ron Peterson <ron.peterson@yellowbank.com>:
> How does one convert an octet string (e.g. something like a varlena
> structure) to a Datum? I want to create datums for use w/
> heap_form_tuple in a function returning a tuple containing bytea
> representations of very large integers.
Is this a legitimate/blessed way to go about it?
aval = (bytea *)palloc( len + VARHDRSZ );
VARATT_SIZEP(aval) = len + VARHDRSZ;
memcpy( VARDATA(aval), myrawdata, len );
values[0] = PointerGetDatum(aval);
...etc
tuple = heap_formtuple( tupdesc, values, &isNull );
--
Ron Peterson
https://www.yellowbank.com/