Re: OCTET_LENGTH is wrong

Поиск
Список
Период
Сортировка
От Tatsuo Ishii
Тема Re: OCTET_LENGTH is wrong
Дата
Msg-id 20011119154843U.t-ishii@sra.co.jp
обсуждение исходный текст
Ответ на Re: OCTET_LENGTH is wrong  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
> > What about encoding?
> 
> Single-byte encodings have the same character and byte lengths.  Only
> multi-byte encodings are different, right?
> 
> In thinking about it, I think the function is called octet_length()
> to emphasize is returns the length in octets (bytes) rather than the
> length in characters.

I think Tom's point is whether octet_length() should regard input text
being encoded in the client side encoding or not.

My vote is octet_length() assumes database encodeding.
If you need client side encoded text length, you could do something
like:

select octet_length(convert('foo',pg_client_encoding()));

Note that there was a nasty bug in convert() which prevents above
working. I have committed fixes.
--
Tatsuo Ishii


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: format_type infelicity
Следующее
От: Alessio Bragadini
Дата:
Сообщение: Re: Open items