David Busby <[EMAIL PROTECTED]> writes: > // Put my 32 bytes into the buffer, this works perfect > memcpy(VARDATA(out_text), pbuf, 32); > // Tell it the buffer size > // I don't like that I've got to add the header size myself > // could/should VARATT_SIZEP handle that for me? > VARATT_SIZEP(out_text) = VARHDRSZ + 32;
VARATT_SIZEP can't be changed without breaking lots of extant code. However, there's nothing stopping you from defining your own convenience macro, along the lines of #define SET_CHAR_LEN(ptr, len) (VARATT_SIZEP(ptr) = (len) + VARHDRSZ) regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html