On 9/22/07, Tom Lane <[EMAIL PROTECTED]> wrote: > On grounds of code-space savings I think it might be worth making > these things be simple functions declared in builtins.h; that would > also make it much easier to change their implementations.
I've noticed that this pattern isn't exclusive to the text type; other varlena types like bytea and xmltype seem to have a common requirement to translate to and fro C strings for various jobs. Does it make sense to go one level lower, and make these functions work for any varlena? So far, I've got the following functions doing the work: char * text_cstring(text *t) char * text_cstring_limit(text *t, int len) text * cstring_text(char *s) It wouldn't be difficult at this point to make those functions 'varlena' rather than 'text', and then bytea and xmltype (and any other future types that want to inherit from varlena) can take advantage of them. Thanks for your time, BJ ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings