Re: Turkish locale bug

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sezai YILMAZ <sezaiy(at)ata(dot)cs(dot)hun(dot)edu(dot)tr>
Cc: pgsql-bugs(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Turkish locale bug
Date: 2001-02-20 02:30:14
Message-ID: 10734.982636214@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Sezai YILMAZ <sezaiy(at)ata(dot)cs(dot)hun(dot)edu(dot)tr> writes:
> With Turkish locale it is not possible to write SQL queries in
> CAPITAL letters. SQL identifiers like "INSERT" and "UNION" first
> are downgraded to "nsert" and "unon". Then "nsert" and "unon"
> does not match as SQL identifier.

Ugh.

> for(i = 0; yytext[i]; i++)
> if (isascii((unsigned char)yytext[i]) &&
> isupper(yytext[i]))
> yytext[i] = tolower(yytext[i]);

> I think it should be better to use another thing which does what
> function tolower() does but only in English language. This should
> stay in English locale. I think this will solve the problem.

> yytext[i] += 32;

Hm. Several problems here:

(1) This solution would break in other locales where isupper() may
return TRUE for characters other than 'A'..'Z'.

(2) We could fix that by gutting the isascii/isupper test as well,
reducing it to "yytext[i] >= 'A' && yytext[i] <= 'Z'", but I'd prefer to
still be able to say that "identifiers fold to lower case" works for
whatever the local locale thinks is upper and lower case. It would be
strange if identifier folding did not agree with the SQL lower()
function.

(3) I do not like the idea of hard-wiring knowledge of ASCII encoding
here, even if it's unlikely that anyone would ever try to run Postgres
on a non-ASCII-based system.

I see your problem, but I'm not sure of a solution that doesn't have bad
side-effects elsewhere. Ideas anyone?

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Larry Rosenman 2001-02-20 02:39:15 Re: [HACKERS] Re: Turkish locale bug
Previous Message Jeffrey F. Lawhorn 2001-02-20 01:33:43 regression test problems

Browse pgsql-hackers by date

  From Date Subject
Next Message Larry Rosenman 2001-02-20 02:39:15 Re: [HACKERS] Re: Turkish locale bug
Previous Message Bruce Momjian 2001-02-20 02:02:17 Re: floating point representationu