U
U
un1t2017-04-27 13:15:09
PostgreSQL
un1t, 2017-04-27 13:15:09

Django, Postgres - why doesn't unaccent work in tests?

Tried to run both through ORM and without.

offers = list(Product.objects.filter(name__unaccent='текст'))
cur.execute("select * from catalog_product where unaccent(name)= 'текст'")

The code works, but when I run the tests, an error occurs:
django.db.utils.ProgrammingError: function unaccent(character varying) does not exist
LINE 1: ...g_product"."updated" FROM "catalog_product" WHERE UNACCENT("...
                                                             ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

Migration is:
class Migration(migrations.Migration):

    operations = [
        UnaccentExtension()
    ]

I tried to add "create extension unaccent" right before the call - it swears that it already exists.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
warnabas, 2021-09-02
@warnabas

did you find the answer? I have the same situation only with pg_trgm

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question