> > 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