Re: small bug in to_char and TM prefix, in RC

Lists: pgsql-hackers
From: "Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: small bug in to_char and TM prefix, in RC
Date: 2006-11-29 09:32:30
Message-ID: BAY20-F25C3CEAC21F2E0EE499D12F9E40@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hello,

I tested TM formating with czech names. Upper case chars in name are not
correct. Function upper works perfectly.

Sample:

postgres=# select to_char(date '2006-02-03', 'TMday');
to_char
---------
ptek
(1 &#345;dka)

correct

but

postgres=# select to_char(date '2006-02-03', 'TMDAY');
to_char
---------
PTEK
(1 &#345;dka)

correct is PTEK

without spec. chars
wrong: PaTEK, have be: PATEK

Regards
Pavel Stehule

_________________________________________________________________
Chcete sdilet sve obrazky a hudbu s prateli? http://messenger.msn.cz/


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Pavel Stehule <pavel(dot)stehule(at)hotmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: small bug in to_char and TM prefix, in RC
Date: 2006-11-29 19:53:01
Message-ID: 200611291953.kATJr1108101@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


And this failure is with your translation patch applied?

---------------------------------------------------------------------------

Pavel Stehule wrote:
> Hello,
>
> I tested TM formating with czech names. Upper case chars in name are not
> correct. Function upper works perfectly.
>
> Sample:
>
> postgres=# select to_char(date '2006-02-03', 'TMday');
> to_char
> ---------
> ptek
> (1 &#345;dka)
>
> correct
>
> but
>
> postgres=# select to_char(date '2006-02-03', 'TMDAY');
> to_char
> ---------
> PTEK
> (1 &#345;dka)
>
> correct is PTEK
>
> without spec. chars
> wrong: PaTEK, have be: PATEK
>
> Regards
> Pavel Stehule
>
> _________________________________________________________________
> Chcete sdilet sve obrazky a hudbu s prateli? http://messenger.msn.cz/
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: "Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com>
To: bruce(at)momjian(dot)us
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: small bug in to_char and TM prefix, in RC
Date: 2006-11-29 20:06:07
Message-ID: BAY20-F17DE23816A88AB98EC431FF9E40@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hello,

after apply my patch this bug is only visible (for czech env). Propably in
others languages isn't used diacritic's chars in mont's and days's names.
str_toupper is too simply and don't support UTF8, which isn't for english
problem.

I prepare patch.

Regards
Pavel Stehule

>
>And this failure is with your translation patch applied?
>
>---------------------------------------------------------------------------
>
>Pavel Stehule wrote:
> > Hello,
> >
> > I tested TM formating with czech names. Upper case chars in name are not
> > correct. Function upper works perfectly.
> >
> > Sample:
> >
> > postgres=# select to_char(date '2006-02-03', 'TMday');
> > to_char
> > ---------
> > ptek
> > (1 &#345;dka)
> >
> > correct
> >
> > but
> >
> > postgres=# select to_char(date '2006-02-03', 'TMDAY');
> > to_char
> > ---------
> > PTEK
> > (1 &#345;dka)
> >
> > correct is PTEK
> >
> > without spec. chars
> > wrong: PaTEK, have be: PATEK
> >
> > Regards
> > Pavel Stehule
> >
> > _________________________________________________________________
> > Chcete sdilet sve obrazky a hudbu s prateli? http://messenger.msn.cz/
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 9: In versions below 8.0, the planner will ignore your desire to
> > choose an index scan if your joining column's datatypes do not
> > match
>
>--
> Bruce Momjian bruce(at)momjian(dot)us
> EnterpriseDB http://www.enterprisedb.com
>
> + If your life is a hard drive, Christ can be your backup. +

_________________________________________________________________
Emotikony a pozadi programu MSN Messenger ozivi vasi konverzaci.
http://messenger.msn.cz/


From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Pavel Stehule <pavel(dot)stehule(at)hotmail(dot)com>
Cc: bruce(at)momjian(dot)us, pgsql-hackers(at)postgresql(dot)org
Subject: Re: small bug in to_char and TM prefix, in RC
Date: 2006-11-29 20:14:24
Message-ID: 20061129201424.GE4654@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Nov 29, 2006 at 09:06:07PM +0100, Pavel Stehule wrote:
> Hello,
>
> after apply my patch this bug is only visible (for czech env). Propably in
> others languages isn't used diacritic's chars in mont's and days's names.
> str_toupper is too simply and don't support UTF8, which isn't for english
> problem.
>
> I prepare patch.

What platform is this? Not all platforms are created equal when it
comes to handling of toupper/tolower on unicode charaters.

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.


From: "Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com>
To: kleptog(at)svana(dot)org
Cc: bruce(at)momjian(dot)us, pgsql-hackers(at)postgresql(dot)org
Subject: Re: small bug in to_char and TM prefix, in RC
Date: 2006-11-29 20:25:33
Message-ID: BAY20-F994688393DD2F60769BB8F9E40@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

>
>On Wed, Nov 29, 2006 at 09:06:07PM +0100, Pavel Stehule wrote:
> > Hello,
> >
> > after apply my patch this bug is only visible (for czech env). Propably
>in
> > others languages isn't used diacritic's chars in mont's and days's
>names.
> > str_toupper is too simply and don't support UTF8, which isn't for
>english
> > problem.
> >
> > I prepare patch.
>
>What platform is this? Not all platforms are created equal when it
>comes to handling of toupper/tolower on unicode charaters.
>

postgres=# select version();
version
-----------------------------------------------------------------------------------------------------
PostgreSQL 8.2rc1 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.1.1
20061011 (Red Hat 4.1.1-30)

to_char use pg_toupper

from pgstrcasecmp.c

*
* Fold a character to upper case.
*
* Unlike some versions of toupper(), this is safe to apply to characters
* that aren't lower case letters. Note however that the whole thing is
* a bit bogus for multibyte character sets.
*/

Pavel

_________________________________________________________________
Chcete sdilet sve obrazky a hudbu s prateli? http://messenger.msn.cz/


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Pavel Stehule <pavel(dot)stehule(at)hotmail(dot)com>, bruce(at)momjian(dot)us, pgsql-hackers(at)postgresql(dot)org
Subject: Re: small bug in to_char and TM prefix, in RC
Date: 2006-11-29 20:28:16
Message-ID: 4033.1164832096@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:
> What platform is this? Not all platforms are created equal when it
> comes to handling of toupper/tolower on unicode charaters.

It's pretty much guaranteed not to work on multibyte characters,
regardless of platform :-(. This did not matter for non-localized
month/day names, but it does matter now.

In the context of the existing code, the simplest solution would be
to provide separate translations of "SUNDAY", "Sunday", "sunday" etc
but this will not work for the planned strftime() change.

regards, tom lane