Bug in functions lower(), upper() with SQL_ASCII and LATIN1?

Started by Hans Plumalmost 24 years ago2 messagesbugs
Jump to latest
#1Hans Plum
plum@giub.uni-bonn.de

Hello PostgreSQL Developers,
I could not find a bug report to the functions lower() and upper() on
the todo-list.
Hopefully it is one, so that you are not bored by old tasks ...

Take a look at the code and the reactions of PostgreSQL: When I try to
convert german umlaute, e.g. �,�,� with lower(), I get no lower letters.
With upper() it is the same problem vice verser ...

All the best from Germany,
Hans

ghl=# select version();
version
---------------------------------------------------------------
PostgreSQL 7.1.3 on i686-pc-linux-gnu, compiled by GCC 2.95.3
(1 row)

ghl=# create DATABASE sql_ascii;
CREATE DATABASE
ghl=# \l
List of databases
Database | Owner | Encoding
-----------+----------+-----------
sql_ascii | postgres | SQL_ASCII
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
(6 rows)

ghl=# \c sql_ascii
You are now connected to database sql_ascii.
sql_ascii=# select lower('OAU');
lower
-------
oau
(1 row)

sql_ascii=# select lower('���');
lower
-------
���
(1 row)

---------------------------------------------------------------------

sql_ascii=# CREATE DATABASE latin1 WITH ENCODING = 'latin1';
CREATE DATABASE
sql_ascii=# \l
List of databases
Database | Owner | Encoding
-----------+----------+-----------
latin1 | postgres | LATIN1
sql_ascii | postgres | SQL_ASCII
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
(7 rows)

latin1=# select lower('OAU');
lower
-------
oau
(1 row)

latin1=# select lower('���');
lower
-------
���
(1 row)

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Hans Plum (#1)
Re: Bug in functions lower(), upper() with SQL_ASCII and LATIN1?

Hans Plum <plum@giub.uni-bonn.de> writes:

Take a look at the code and the reactions of PostgreSQL: When I try to
convert german umlaute, e.g. �,�,� with lower(), I get no lower letters.
With upper() it is the same problem vice verser ...

This is determined by locale, not encoding. I think you are not running
the database in the right locale.

regards, tom lane