PostgreSQL 7.x - Problem with Turkish localization

Hi.

I had a problem with Turkish localization of PostgreSQL 7.x. But I solved
it by myself.

Description:

I configure and compile PostgreSQL 7.x source 
with "--enable-locale" parameter. Before running
postmaster I set environment variables related with 
locale support of my Linux box.


------------------------------------------
LC_CTYPE=tr_TR
LC_COLLATE=tr_TR
LC_ALL=tr_TR
LANG=tr

export LC_CTYPE LC_COLLATE LC_ALL

postmaster .... (and necessary paramters)
------------------------------------------


So far everything is ok. I run these commands:


------------------------------------------
template1=# create database dummy;
CREATE DATABASE
template1=# \c dummy
You are now connected to database dummy.
dummy=# create table atable (x char(12));
CREATE
dummy=# \d 
ERROR:  parser: parse error at or near "unıon"
ERROR:  parser: parse error at or near "unıon"
------------------------------------------

Localization support of PostgreSQL is achieved
by the help of UNIX locale support defined in 
standart C libraries (PostgreSQL uses tolower 
function). SQL commands are written with 
capital letters in file 
postgresql-7.x/src/backend/parser/gram.c.
Before executing SQL commands, they are translated
into lowercase letters with tolower() function.
As seen above "UNION" is translated into "unıon"
instead of "union" and then is executed. In Turkish 
alphabet lowercase of "I" is "ı" (y acute, not "i") and 
uppercase of "i" is "I" (Y acute, not "I").




Solution:


To solve this problem I convert all SQL commands
written statically in yytname character array into 
lowercase commands (in file 
postgresql-7.x/src/backend/parser/gram.c). Now I 
am happy with my PostgreSQL and its Turkish 
language support. It also has some problems 
(I can not write queries in capital letters, 
because of the same behaviour descibed above) but 
it is not a matter.



Sezai

Reply via email to