From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | Martín Marqués <martin(at)bugs(dot)unl(dot)edu(dot)ar> |
Cc: | PostgreSQL general list <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: locale and spanish acute |
Date: | 2001-09-14 13:49:29 |
Message-ID: | Pine.LNX.4.30.0109141544150.691-100000@peter.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)gmx(dot)net http://funkturm.homeip.net/~peter
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Brickley | 2001-09-14 13:50:46 | Numerical DB/Table Names |
Previous Message | Erol Öz | 2001-09-14 13:13:55 | pg_dump error - LOCALIZATION PROBLEM |