From: | "E(dot)Rodichev" <er(at)sai(dot)msu(dot)su> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Encoding problem with 7.4 |
Date: | 2003-11-27 19:56:34 |
Message-ID: | Pine.GSO.4.58.0311272251560.12305@ra.sai.msu.su |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
I just noticed some incorrect behaviour for postgresql-7.4 related
to locale.
After installing 7.4 I created database completely from scratch
with cyrillic locale:
su postgres
export LC_CTYPE=ru_RU.KOI8-R
export LC_COLLATE=ru_RU.KOI8-R
/usr/local/pgsql/bin/initdb -D /db2/pgdata
/usr/local/pgsql/bin/createuser -d er
Then I switch off to my normal account. At this point I have:
/e:1>psql -l
List of databases
Name | Owner | Encoding
-----------+----------+-----------
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
(2 rows)
Then I created new db:
/e:2>createdb test
CREATE DATABASE
/e:3>psql -l
List of databases
Name | Owner | Encoding
-----------+----------+-----------
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
test | er | SQL_ASCII <----- Incorrect!
(3 rows)
Let's note than the last line is in fact completely incorrect.
DB test is really in ru_RU.KOI8-R, not ASCII. I can create tables
with ascii characters, and with non-ascii (cyrillic) as well,
and order by, select upper, etc. works in ru_RU.KOI8-R locale.
After first initdb it doesn't affected by my LC_CTYPE and LC_COLLATE
settings. I may set
export LC_CTYPE=ru_RU.KOI8-R
export LC_COLLATE=ru_RU.KOI8-R
or
export LC_CTYPE=C
export LC_COLLATE=C
but order by and select upper works really in cyrillic locale.
As I may see, there are two points here:
1. Reporting Encoding as SQL_ASCII is incorrect - all db are in KOI8,
not in SQL_ASCII;
2. More generally, such kind of fixed locale behaviour is not very
convenient. More natural way looks as follows: the user got
a db encoding as it specified at the moment createdb is issued.
By this way it will be possible to have different databases with
different encodings.
Best regards,
Evgeny Rodichev
_________________________________________________________________________
Evgeny Rodichev Sternberg Astronomical Institute
email: er(at)sai(dot)msu(dot)su Moscow State University
Phone: 007 (095) 939 2383
Fax: 007 (095) 932 8841 http://www.sai.msu.su/~er
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2003-11-27 20:21:50 | Re: Encoding problem with 7.4 |
Previous Message | Peter Eisentraut | 2003-11-27 18:17:14 | Re: building outside source tree |