Hi, A year ago Nicolai Tufar <[EMAIL PROTECTED]> submitted a patch to change lower-case conversion of identifiers from locale-dependent to ASCII in this thread:
http://archives.postgresql.org/pgsql-hackers/2002-11/msg01159.php Tom Lane argued that SQL99 standard states that identifier case convervisons are to be done on the basis of Unicode upper/lower case equivalencies and that locale-based conversion is closer than ASCII-only. And the patch was rejected. Now, PostgreSQL 7.4 initdb fails if run with locale set to tr_TR: ---------------------------------------------------------------------------- [EMAIL PROTECTED] backend]$ initdb -D /usr/local/pgsql/data --locale=tr_TR The files belonging to this database system will be owned by user "pgsql74". This user must also own the server process. The database cluster will be initialized with locale tr_TR. fixing permissions on existing directory /usr/local/pgsql/data... ok creating directory /usr/local/pgsql/data/base... ok creating directory /usr/local/pgsql/data/global... ok creating directory /usr/local/pgsql/data/pg_xlog... ok creating directory /usr/local/pgsql/data/pg_clog... ok selecting default max_connections... 100 selecting default shared_buffers... 1000 creating configuration files... ok creating template1 database in /usr/local/pgsql/data/base/1... ok initializing pg_shadow... ok enabling unlimited row size for system tables... ok initializing pg_depend... ok creating system views... ok loading pg_description... ok creating conversions... NOTICE: type "voıd" is not yet defined DETAIL: Creating a shell type definition. ERROR: type cstrıng does not exist initdb: failed [EMAIL PROTECTED] backend]$ ----------------------------------------------------------------- Failure is caused by the following statement: CREATE OR REPLACE FUNCTION ascii_to_mic (INTEGER, INTEGER, CSTRING,CSTRING, INTEGER) RETURNS VOID AS '$libdir/ascii_and_mic', 'ascii_to_mic' LANGUAGE 'c' STRICT; from file share/conversion_create.sql As you can see "I" in "VOID" gets converted to i-dotless in conformance to tr_TR Locale conversion rules, which is not an expected behaviour for Turkish users who set their locale to tr_TR. Attached is a two-line patch that changes identifier name conversion in backend/parser/scan.l from tolower() to a simple ASCII based one. It will solve database creation problem but apparently will break upper-lower case conversion of identifiers in national languages, like Russian or Korean. So what shall be done? Would you like us to prepare a patch that will change identifer case conversion behaviour only when locale is set to tr_TR? Regards, -- Devrim GUNDUZ [EMAIL PROTECTED] [EMAIL PROTECTED] http://www.TDMSoft.com http://www.gunduz.org
*** ./backend/parser/scan.l.orig 2003-12-15 19:26:55.000000000 +0200 --- ./backend/parser/scan.l 2003-12-15 19:44:21.000000000 +0200 *************** *** 553,560 **** ident = pstrdup(yytext); for (i = 0; ident[i]; i++) { ! if (isupper((unsigned char) ident[i])) ! ident[i] = tolower((unsigned char) ident[i]); } if (i >= NAMEDATALEN) { --- 553,560 ---- ident = pstrdup(yytext); for (i = 0; ident[i]; i++) { ! if ( ident[i] >= 'A' && ident[i] <= 'Z') ! ident[i] = ident[i] + 'a' - 'A'; } if (i >= NAMEDATALEN) {
---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org