Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> writes:
> Could we rely on pg_encoding_max_length() instead of MAX_MULTIBYTE_CHAR_LEN? That
> would then work for short characters too IIUC.
No. We don't know which encoding it is. Even if you wanted to say
"use the database encoding", we haven't identified the database yet.
regards, tom lane