Re: Text <-> C string
| От | Tom Lane |
|---|---|
| Тема | Re: Text <-> C string |
| Дата | |
| Msg-id | 27144.1190900934@sss.pgh.pa.us обсуждение |
| Ответ на | Re: Text <-> C string ("Brendan Jurd" <direvus@gmail.com>) |
| Ответы |
Re: Text <-> C string
|
| Список | pgsql-hackers |
"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
В списке pgsql-hackers по дате отправления: