Re: [PATCHES] Text <-> C string

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [PATCHES] Text <-> C string
Дата
Msg-id 22724.1209919755@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [PATCHES] Text <-> C string  ("Brendan Jurd" <direvus@gmail.com>)
Список pgsql-hackers
"Brendan Jurd" <direvus@gmail.com> writes:
> Well ... if somebody does want to change the representation of xml
> down the road, he's going to have to touch all the sites where the
> code converts to and from cstring anyway, right?

True.

> With that in mind, please find attached my followup patch.  It cleans
> up another 21 sites manually copying between cstring and varlena, for
> a net reduction of 115 lines of code.

I applied most of this, but not the parts that were dependent on the
assumption that bytea and text are the same.  That is unlikely to remain
true if we ever get around to putting locale/encoding information into
text values.  Furthermore it's a horrid type pun, because bytea can
contain embedded nulls whereas cstrings can't; you were making
unwarranted assumptions about whether, say, cstring_to_text_with_len
would allow embedded nulls to go by.  And lastly, quite a few of those
changes were just plain broken, eg several places in selfuncs.c where
you allowed strlen() to be applied to a "bytea converted to cstring".

            regards, tom lane

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Treat
Дата:
Сообщение: Re: [PATCHES] GUC parameter cursors_tuple_fraction
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Proposed Patch - LDAPS support for servers on port 636 w/o TLS