Re: how to ignore accents?
От | Ennio-Sr |
---|---|
Тема | Re: how to ignore accents? |
Дата | |
Msg-id | 20050331183802.GA3060@deby.ei.hnet обсуждение исходный текст |
Ответ на | Re: how to ignore accents? (Michael Fuhr <mike@fuhr.org>) |
Ответы |
Re: how to ignore accents?
|
Список | pgsql-novice |
* Michael Fuhr <mike@fuhr.org> [300305, 17:42]: > On Thu, Mar 31, 2005 at 02:01:45AM +0200, Ennio-Sr wrote: > > > > I'm not an expert, but I'm afraid it's not possible to do that (and I'd > > be glad if somebody came out saying I'm wrong as I've the same problem). > > You could write an unaccent() function that calls translate(). > > http://www.postgresql.org/docs/8.0/interactive/functions-string.html > > Here's an (incomplete) example that works in PostgreSQL 8.0.2beta1: > > CREATE FUNCTION unaccent(text) RETURNS text AS $$ > BEGIN > RETURN translate($1, '\342\347\350\351\352\364\373', 'aceeeou'); > END; > $$ LANGUAGE plpgsql IMMUTABLE STRICT; > Thank you, Michael, for correcting my pessimism (and ignorance ... :-). Is there any chance to have that work with PostgreSQL-7.4.7-2 (the latest available from Debian/sarge)? I put those instructions in a .sql file, did: mydb=> \i unaccent.sql and got: psql:unaccent.sql:3: ERROR: syntax error at or near "$" at character 50 psql:unaccent.sql:4: WARNING: there is no transaction in progress COMMIT psql:unaccent.sql:5: ERROR: syntax error at or near "$" at character 3 Regards, Ennio. -- [Perche' usare Win$ozz (dico io) se ..."anche uno sciocco sa farlo. \\?// Fa' qualche cosa di cui non sei capace!" (diceva Henry Miller) ] (°|°) [Why use Win$ozz (I say) if ... "even a fool can do that. )=( Do something you aren't good at!" (as Henry Miller used to say) ]
В списке pgsql-novice по дате отправления: