Peter Eisentraut <peter_e@gmx.net> writes:
> Tom Lane writes:
>> What's bothering me right now is the difference between client and
>> server encodings.
> OCTET_LENGTH returns the size of its argument, not the size of some
> possible future shape of that argument.
That would serve equally well as an argument for returning the
compressed length of the string, I think. You'll need to do better.
My take on it is that when a particular client encoding is specified,
Postgres does its best to provide the illusion that your data actually
is stored in that encoding. If we don't make OCTET_LENGTH agree, then
we're breaking the illusion.
regards, tom lane