Swedish characters

Started by Rickard Annellabout 25 years ago3 messagesbugs
Jump to latest
#1Rickard Annell
Rickard.Annell@udac.se

============================================================================
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

#2Peter Eisentraut
peter_e@gmx.net
In reply to: Rickard Annell (#1)
Re: Swedish characters

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/

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Rickard Annell (#1)
Re: Swedish characters

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