"Brendan Jurd" <direvus@gmail.com> writes:
> 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.
Mmm, but the conversions are generally not identical --- for instance,
bytea needs to do escaping/de-escaping, and I doubt that XML will stick
to dumb flat-string representation for long, and for that matter text
itself is likely to change someday for better locale support. Where the
representations and conversions *are* identical, one can just cast.
I'd vote for keeping the names focused on text ...
regards, tom lane