1

I have a POSTGRESQL Database with names like:

ʿImād ad-Daula Abu ᾽l-Ḥasan

The user may select this value by typing into a text field. But I would like the user to use similar characters. So, that he can type: "imad" or "hasan". And still get the same result.

It seems a kinda basic problem to me, but I have not found a solution so far.

I tried it with:

SELECT * FROM person WHERE name ILIKE '%hasan%' ORDER BY name ASC

But it doesn't work for these characters. I would be really greatful for suggestions.

Thanks

1 Answer 1

1

You can install the extension unaccent:

CREATE EXTENSION unaccent;

And then you are able to do:

SELECT * FROM person WHERE unaccent(name) ILIKE '%hasan%' ORDER BY name ASC
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, on a first glance, that works great! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.