I created a database in PostgreSQL with "encoding = 'UTF8'", and loaded some UTF8 data in it. Selecting works fine, but when I try to do a "WHERE UPPER(name) = 'FOO'" in a query, I get an error
ERROR: invalid multibyte character for locale
My research seems to indicate that this is because the PostgreSQL installation was "initdb"-ed with LANG=en_US
rather than LANG=en_US.UTF8
. Doing a "SHOW LC_COLLATE
" shows "en_US
". I don't want to have to dump and recreate all my databases, because several of them are PostGIS and it's a royal pain to recreate those. Is there a work-around, like a way to do the equivalent of "UPPER" that works for UTF8?
Update I ended up doing the dump, reinitdb, and restore of the database, and it was less painful than I thought it would be, except for a bit of a problem figuring out where the data was supposed to go because the postgres user doesn't set the PGDATA environment variable, and neither does any config file or shell script that I could find.