From fdf719cd2868144b5bd78971217bb36bb970e15e Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Thu, 22 Mar 2012 15:45:42 -0400 Subject: [PATCH] Doc clarifications regarding use of varlena. Jay Levitt, reviewed by Tom Lane. --- doc/src/sgml/xfunc.sgml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml index d81d63f922..e8620ef073 100644 --- a/doc/src/sgml/xfunc.sgml +++ b/doc/src/sgml/xfunc.sgml @@ -1767,7 +1767,8 @@ typedef struct Finally, all variable-length types must also be passed by reference. All variable-length types must begin - with a length field of exactly 4 bytes, and all data to + with an opaque length field of exactly 4 bytes, which will be set + by SET_VARSIZE; never set this field directly! All data to be stored within that type must be located in the memory immediately following that length field. The length field contains the total length of the structure, @@ -1833,7 +1834,7 @@ memcpy(destination->data, buffer, 40); ]]> - VARHDRSZ is the same as sizeof(int4), but + VARHDRSZ is the same as sizeof(int32), but it's considered good style to use the macro VARHDRSZ to refer to the size of the overhead for a variable-length type. Also, the length field must be set using the