Re: Locale and LIKE matching - Mailing list pgsql-general

From ADBAAMD
Subject Re: Locale and LIKE matching
Date
Msg-id 3AC4FCF7.70208@bell.ca
Whole thread Raw
In response to Locale and LIKE matching  (Daniel Serodio <daniel@ibnetwork.com.br>)
List pgsql-general
Daniel Serodio wrote:

 >     Hi! I'd like to know if the LIKE operator is locale-aware when
matching
 > strings. Specifically, I'd like to have "... LIKE '%a%'" match "á"
(á)or
 > "ã" (ã) (these are ISO8859-1, pt_BR chars). Is this possible? I've
 > compiled postgresql 7.0.2 with --enable-locale --enable-multibyte,
and created
 > the DB with latin1 encoding, but it still doesn't work as I'd like.
 > TIA

     I can feel your pain...

     The LIKE operators and its wildcard characters are a misfeature of SQL
itself.  Fortunately for us PostgreSQL has regular expressions as an
extension to SQL -- look
http://www.postgresql.org/users-lounge/docs/7.0/user/operators2123.htm.

     I would do ~ '.*[aáã].*' or something like it.  For documentation, try
man 5 regexp or at Emacs man regexp(5).



--
  _
/ \   Leandro Guimarães Faria Corsetti Dutra         +55 (11) 3040 8913
\ /   Amdocs at Bell Canada                          +1 (514) 786 87 47
  X    Support Center, São Paulo, Brazil          mailto:adbaamd@bell.ca
/ \   http://terravista.pt./Enseada/1989/    mailto:leandrod@amdocs.com



pgsql-general by date:

Previous
From: Daniel Serodio
Date:
Subject: Locale and LIKE matching
Next
From: Peter Eisentraut
Date:
Subject: Re: Locale and LIKE matching