Re: locale and spanish acute

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: locale and spanish acute
Дата
Msg-id Pine.LNX.4.30.0109141544150.691-100000@peter.localdomain
обсуждение исходный текст
Ответ на Re: locale and spanish acute  (Martín Marqués <martin@bugs.unl.edu.ar>)
Ответы Re: locale and spanish acute
Список pgsql-general
Martín Marqués writes:

> select count(*) from tab1 where col1 LIKE '%mas%'
>
> but I would like it to catch rows with "más" also.
>
> The only thing I can think of is makeing a function that applied to col1
> would give me col1 but without accents. Say the function is called
> no_accents, so:
>
> no_accents(más)=mas
>
> Now, the problem is that I have little idea on making such a function. Is it
> very difficult?

CREATE FUNCTION no_accents(text) RETURNS text AS '
my $arg = $_[0];
$arg =~ tr/áéëíñóú/aeeinou/;
return $arg;
' LANGUAGE 'plperl';

Something similar should be possible in PL/Tcl if you prefer that.  Or you
bother with C and run a simple loop over the text string.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


В списке pgsql-general по дате отправления:

Предыдущее
От: "Erol Öz"
Дата:
Сообщение: pg_dump error - LOCALIZATION PROBLEM
Следующее
От: "mike"
Дата:
Сообщение: Undefined All PQ keywords