Thread: Swedish characters
============================================================================ POSTGRESQL BUG REPORT TEMPLATE ============================================================================ Your name : Rickard Annell Your email address : Rickard.Annell@udac.se System Configuration --------------------- Architecture (example: Intel Pentium) : PowerPC 604e Operating System (example: Linux 2.0.26 ELF) : AIX v 4.3.3 PostgreSQL version (example: PostgreSQL-7.1): PostgreSQL-7.1beta5 Compiler used (example: gcc 2.8.0) : gcc v. 2.95.2 Please enter a FULL description of your problem: ------------------------------------------------ Problem with match swedish characters in SQL query. Please describe a way to repeat the problem. Please try to provide a concise reproducible example, if at all possible: ---------------------------------------------------------------------- ./configure --prefix=/service/database/postgres_test --enable-odbc --enable-local export LC_ALL=sv_SE export LC_CTYPE=sv_SE export LC_COLLATE=sv_SE nohup ./postmaster -p 5431 -i >server.log 2>&1 & ./createdb -p 5431 cybertest ./psql -p 5431 cybertest create table test (id int , name varchar,primary key(id)); insert into test values (1,'Åsbrink'); select * from test where lower(name) like '%å%'; id | name ----+------ (0 rows) I think "lower(name) like '%å%'" should match. If i try "lower(name) like '%Å%'" I get one row. If you know how this problem might be fixed, list the solution below: --------------------------------------------------------------------- -- ___________________________________________________________________ Rickard Annell E-mail: Rickard.Annell@udac.se SYSteam Udac WWW: http://www.udac.se Tel: +46 (0)18 4717700 Box 174, S-751 04 Uppsala, Sweden Fax: +46 (0)18 516600
Rickard Annell writes: > ./configure --prefix=/service/database/postgres_test --enable-odbc > --enable-local --enable-locale > export LC_ALL=sv_SE > export LC_CTYPE=sv_SE > export LC_COLLATE=sv_SE > > nohup ./postmaster -p 5431 -i >server.log 2>&1 & > ./createdb -p 5431 cybertest > ./psql -p 5431 cybertest > create table test (id int , name varchar,primary key(id)); > insert into test values (1,'Åsbrink'); > select * from test where lower(name) like '%å%'; > id | name > ----+------ > (0 rows) > > I think "lower(name) like '%å%'" should match. If i try "lower(name) > like '%Å%'" I get one row. -- Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
Rickard Annell <Rickard.Annell@udac.se> writes: > ./configure --prefix=/service/database/postgres_test --enable-odbc > --enable-local > export LC_ALL=sv_SE > export LC_CTYPE=sv_SE > export LC_COLLATE=sv_SE > nohup ./postmaster -p 5431 -i >server.log 2>&1 & You do know that under 7.1, the important LC_ values are the ones that initdb sees, not the ones that the postmaster sees, right? Can't tell from this snippet whether you initdb'd in Swedish locale or not. > create table test (id int , name varchar,primary key(id)); > insert into test values (1,'Åsbrink'); > select * from test where lower(name) like '%å%'; > id | name > ----+------ > (0 rows) Is this a bug? I'd sort of think that 'å' is not lower case (although maybe my mail reader isn't presenting it in the right font ... it looks like an accented upper case I to me, but what do you think it is?). Shouldn't you say "where lower(name) like lower('%å%')"? Or perhaps use ILIKE to get a case-insensitive compare. regards, tom lane