mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
Solve the 'Turkish problem' with undesirable locale behavior for case
conversion of basic ASCII letters. Remove all uses of strcasecmp and strncasecmp in favor of new functions pg_strcasecmp and pg_strncasecmp; remove most but not all direct uses of toupper and tolower in favor of pg_toupper and pg_tolower. These functions use the same notions of case folding already developed for identifier case conversion. I left the straight locale-based folding in place for situations where we are just manipulating user data and not trying to match it to built-in strings --- for example, the SQL upper() function is still locale dependent. Perhaps this will prove not to be what's wanted, but at the moment we can initdb and pass regression tests in Turkish locale.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.126 2004/03/30 15:53:18 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.127 2004/05/07 00:24:58 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -794,7 +794,7 @@ ParseDateTime(const char *timestr, char *lowstr,
|
||||
{
|
||||
ftype[nf] = DTK_DATE;
|
||||
while (isalnum((unsigned char) *cp) || (*cp == delim))
|
||||
*lp++ = tolower((unsigned char) *cp++);
|
||||
*lp++ = pg_tolower((unsigned char) *cp++);
|
||||
}
|
||||
}
|
||||
|
||||
@ -822,9 +822,9 @@ ParseDateTime(const char *timestr, char *lowstr,
|
||||
else if (isalpha((unsigned char) *cp))
|
||||
{
|
||||
ftype[nf] = DTK_STRING;
|
||||
*lp++ = tolower((unsigned char) *cp++);
|
||||
*lp++ = pg_tolower((unsigned char) *cp++);
|
||||
while (isalpha((unsigned char) *cp))
|
||||
*lp++ = tolower((unsigned char) *cp++);
|
||||
*lp++ = pg_tolower((unsigned char) *cp++);
|
||||
|
||||
/*
|
||||
* Full date string with leading text month? Could also be a
|
||||
@ -860,9 +860,9 @@ ParseDateTime(const char *timestr, char *lowstr,
|
||||
else if (isalpha((unsigned char) *cp))
|
||||
{
|
||||
ftype[nf] = DTK_SPECIAL;
|
||||
*lp++ = tolower((unsigned char) *cp++);
|
||||
*lp++ = pg_tolower((unsigned char) *cp++);
|
||||
while (isalpha((unsigned char) *cp))
|
||||
*lp++ = tolower((unsigned char) *cp++);
|
||||
*lp++ = pg_tolower((unsigned char) *cp++);
|
||||
}
|
||||
/* otherwise something wrong... */
|
||||
else
|
||||
|
Reference in New Issue
Block a user