> Short Description
> lower()/upper() bug on ->multibyte<- DB
>
> Long Description
> OS: Linux Kernel 2.4.4, PostgreSQL version 7.2.1
> lower() and upper() doesn't work like expected for multibyte
> databases. It is working fine for one-byte encoding.
> The behaviour can be reproduced as follows:
> at initdb: LC_CTYPE was set to de_DE
> createdb -E UTF-8 name
> export PGCLIENTENCODING=LATIN1
> psql -U name
> --------------------------------------------------
> => select lower('D'); -- german umlaut A, capital
> ERROR: Could not convert UTF-8 to ISO8859-1
> -- I expected to see: d german umlaut a, lower case
This is not a bug but an expected behavior. Locale support expects an
input string is encoded in ISO-8859-1 (because you set locale to
de_DE) while you supply UTF-8. Try an explicit encoding converion
function:
select lower(convert('D'), 'LATIN1');
Note that '\304' must be an actual german umlaut A, capital character,
not an octal espcaped notion.
--
Tatsuo Ishii