Re: Locale and LIKE matching

From: "ADBAAMD" <adba(dot)amdocs(at)bell(dot)ca>
To: "Daniel Serodio" <daniel(at)ibnetwork(dot)com(dot)br>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Locale and LIKE matching
Date: 2001-03-30 21:39:03
Message-ID: 3AC4FCF7.70208@bell.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 "á"
(&aacute;)or
> "ã" (&atilde;) (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(at)bell(dot)ca
/ \ http://terravista.pt./Enseada/1989/ mailto:leandrod(at)amdocs(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Oliver Elphick 2001-03-30 21:40:36 Re: Data access permission?
Previous Message IGB.NET 2001-03-30 20:49:55