On Wed, Dec 15, 2004 at 11:08:29PM -0500, Ron Peterson wrote:
> How are bytea values encoded internally?
>
> Or maybe a better question would be what is the proper way to access
> bytea data from within a C function? Are there utility functions for
> reading the bytea data as a stream of scalar values, for example?
Do you mean a C function on the server side or on the client side?
For examples of server-side code, take a look at functions in the
PostgreSQL source that handle BYTEA, e.g., byteacat() in
src/backend/utils/adt/varlena.c. See also the comments concerning
variable-length data and the relevant examples in the "C-Language
Functions" section of the "Extending SQL" chapter in the documentation.
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/