Re: 7.4.1 release status - Turkish Locale - Mailing list pgsql-hackers

From Tom Lane
Subject Re: 7.4.1 release status - Turkish Locale
Date
Msg-id 11795.1075609384@sss.pgh.pa.us
Whole thread Raw
In response to Re: 7.4.1 release status - Turkish Locale  ("Nicolai Tufar" <ntufar@pisem.net>)
Responses Re: 7.4.1 release status - Turkish Locale  ("Nicolai Tufar" <ntufar@pisem.net>)
List pgsql-hackers
"Nicolai Tufar" <ntufar@pisem.net> writes:
>> We might think that the Turkish-locale problem Devrim Gunduz pointed out
>> is a must-fix, too.  But I'm not convinced yet what to do about it.
> Here is a first try to fix what Devrim Gunduz talked about.

I still don't much like having a locale-specific wart in the parser
(and the code you give could not work anyway --- for starters, the
first argument of setlocale is not a pointer).

A possible compromise is to apply ASCII downcasing (same as in
keywords.c) for 7-bit-ASCII characters, and apply tolower() only
for character codes above 127.  In other words
unsigned char ch = (unsigned char) ident[i];
if (ch >= 'A' && ch <= 'Z')    ch += 'a' - 'A';else if (ch > 127 && isupper(ch))    ch = tolower(ch);ident[i] = (char)
ch;

In reasonably sane locales this will have the same effects as currently,
while in unsane locales it will ensure that basic-ASCII identifiers are
treated the way we want.

Comments?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Joe Conway
Date:
Subject: Re: [PATCHES] v7.4.1 text_position() patch
Next
From: Tom Lane
Date:
Subject: Re: Make length(char(n)) return 'true' length