| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | "Brendan Jurd" <direvus(at)gmail(dot)com> |
| Cc: | "Gregory Stark" <stark(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Text <-> C string |
| Date: | 2007-09-27 13:48:54 |
| Message-ID: | 27144.1190900934@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers pgsql-patches |
"Brendan Jurd" <direvus(at)gmail(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2007-09-27 14:08:32 | Re: [COMMITTERS] pgsql: Temporarily modify tsearch regression tests to suppress notice |
| Previous Message | Brendan Jurd | 2007-09-27 13:41:52 | Re: Text <-> C string |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2007-09-27 14:08:32 | Re: [COMMITTERS] pgsql: Temporarily modify tsearch regression tests to suppress notice |
| Previous Message | Brendan Jurd | 2007-09-27 13:41:52 | Re: Text <-> C string |