LC_CTYPE and matching accented chars

From: Martin Langhoff <martin(at)catalyst(dot)net(dot)nz>
To: pgsql-general(at)postgresql(dot)org
Subject: LC_CTYPE and matching accented chars
Date: 2007-06-20 12:51:59
Message-ID: 467922EF.6010509@catalyst.net.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Trying to understand how I can get Pg 8.2 to match 'martín' when I
search for 'martin', and going through the documentation, specially

http://www.postgresql.org/docs/8.2/static/locale.html
http://www.postgresql.org/docs/8.1/static/functions-matching.html

Here is a transcript of my commandline - I suspect I am quite close, but
something is missing. Hints _really_ appreciated!

# do I have a Spanish locale on this box?
locale -a
# no I don't - let's make one
sudo locale-gen es_AR.utf8
# check that I have it
locale -a
...
sudo pg_createcluster --locale=es_AR.utf8 8.2 arg
sudo pg_ctlcluster 8.2 arg start
sudo -u postgres createdb --cluster 8.2/arg testing
sudo -u postgres psql --cluster 8.2/arg testing
# in psql...
=# create table test (value text);
CREATE TABLE
=# insert into test values ('martín');
INSERT 0 1

# this is apparently the right way to
# select base character based on the "equivalence class"
# as defined in the LC_CTYPE
=# select * from test where value ~ 'mart[=i=]n';
value
-------
(0 rows)
# grumble - double check
=# SHOW LC_CTYPE;
lc_ctype
------------
es_AR.utf8

Any hints in general?

- How can I read the LC_CTYPE definition? IOWs locale-gen has created a
binary blob in /usr/lib/locale/es_AR.utf8/LC_CTYPE but I sure there is
a human-readable definition somewhere...

- Is that the correct syntax?

- Pg bug? I doubt many people are counting on this behaviour... as it
seems to be widely announced to be brittle and slow.

cheers,

m
--
-----------------------------------------------------------------------
Martin @ Catalyst .Net .NZ Ltd, PO Box 11-053, Manners St, Wellington
WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St
OFFICE: +64(4)916-7224 UK: 0845 868 5733 ext 7224 MOB: +64(21)364-017
Make things as simple as possible, but no simpler - Einstein
-----------------------------------------------------------------------

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Reyes 2007-06-20 13:15:37 Re: pg_restore out of memory
Previous Message Rhys Stewart 2007-06-20 12:25:03 Re: regexp searching in arrays not working?