patch: Use pg_mbcliplen for truncation in text-to-name conversion

Started by Karl Schnaitteralmost 14 years ago2 messageshackers
Jump to latest
#1Karl Schnaitter
karlsch@gmail.com

The text_name function was truncating its input string to the first
NAMEDATALEN-1 bytes, which is wrong if the string has multi-byte
characters. This patch changes it to use pg_mbcliplen, following
the namein function.

Attachments:

text_to_name.patchtext/plain; name=text_to_name.patchDownload+18-2
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Karl Schnaitter (#1)
Re: patch: Use pg_mbcliplen for truncation in text-to-name conversion

Karl Schnaitter <karlsch@gmail.com> writes:

The text_name function was truncating its input string to the first
NAMEDATALEN-1 bytes, which is wrong if the string has multi-byte
characters. This patch changes it to use pg_mbcliplen, following
the namein function.

Good catch, but poking around I note that bpchar_name has the same
disease. Will fix, thanks for the report!

regards, tom lane