Re: character type value is not padded with spaces
- From: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
- To: y-asaba(at)sra(dot)co(dot)jp
- Cc: pgsql-patches(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
- Subject: Re: character type value is not padded with spaces
- Date: Tue, 24 May 2005 07:51:42 +0900 (JST)
- Message-id: <20050524.075142.116347070.t-ishii@sra.co.jp> <text/plain>
Hackers,
The problem he found is not only existing in Japanese characters but
also in any multibyte encodings including UTF-8. For me the patch
looks good and I will commit it to 7.3, 7.4, 8.0 stables and current
if there's no objection.
--
Tatsuo Ishii
> Character type value including multibyte characters is not padded
> with spaces. It reproduces at 7.3.x, 7.4.x and 8.0.x.
>
> create table t (a char(10));
> insert into t values ('XXXXX'); -- X is 2byte character.
>
> I expect that 'XXXXX ' is inserted. But 'XXXXX' is inserted.
>
> select a, octed_length(a) from t;
>
> a | octet_length
> -------+--------------
> XXXXX | 10
>
> If padded with spaces, octet_length(a) is 15. This problem is caused
> that string length is calculated by byte length(VARSIZE) in
> exprTypmod().
>
> I attache the patch for this problem.
>
> Regards,
>
> --
> Yoshiyuki Asaba
> y-asaba(at)sra(dot)co(dot)jp
Home |
Main Index |
Thread Index