Re: [PATCHES] character type value is not padded with spaces

From: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
To: john(at)geeknet(dot)com(dot)au
Cc: y-asaba(at)sra(dot)co(dot)jp, pgsql-patches(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCHES] character type value is not padded with spaces
Date: 2005-05-23 23:25:58
Message-ID: 20050524.082558.133288774.t-ishii@sra.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

I think you need to test with 5 characters, not 3.
--
Tatsuo Ishii

> Ahemm,...
>
> UNICODE DB:
>
> create table t (a char(10));
> set client_encoding = iso88591;
> insert into t VALUES ('æøå');
>
> select a, octet_length(a),length(a) from t;
> a | octet_length | length
> ------------+--------------+--------
> æøå | 13 | 3
> (1 row)
>
> This is with 8.0.2.
>
> Just FYI.
>
> ... John
>
> > -----Original Message-----
> > From: pgsql-patches-owner(at)postgresql(dot)org
> > [mailto:pgsql-patches-owner(at)postgresql(dot)org] On Behalf Of Tatsuo Ishii
> > Sent: Tuesday, May 24, 2005 8:52 AM
> > To: y-asaba(at)sra(dot)co(dot)jp
> > Cc: pgsql-patches(at)postgresql(dot)org; pgsql-hackers(at)postgresql(dot)org
> > Subject: Re: [PATCHES] character type value is not padded with spaces
> >
> > 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
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 2: you can get off all lists at once with the unregister command
> > (send "unregister YourEmailAddressHere" to
> > majordomo(at)postgresql(dot)org)
> >
> >
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message John Hansen 2005-05-23 23:29:01 Re: [PATCHES] character type value is not padded with spaces
Previous Message John Hansen 2005-05-23 23:05:34 Re: [PATCHES] character type value is not padded with spaces

Browse pgsql-patches by date

  From Date Subject
Next Message John Hansen 2005-05-23 23:29:01 Re: [PATCHES] character type value is not padded with spaces
Previous Message John Hansen 2005-05-23 23:05:34 Re: [PATCHES] character type value is not padded with spaces