Tatsuo Ishii <ishii@postgresql.org> writes:
>> If we make convert() operate on bytea and return bytea, as Tom
>> suggested, would that solve your use case?
> The problem is, the above use case is just one of what I can think of.
> Another use case is, something like this:
> SELECT sum(octet_length(convert(text_column using utf8_to_euc_jp))) FROM mytable;
> to know the total byte length of text column if it's encoded in
> EUC_JP.
Since octet_length exists and produces identical results for both text
and bytea, this example is hardly very convincing...
regards, tom lane