diff --git a/nominatim/db/sqlalchemy_functions.py b/nominatim/db/sqlalchemy_functions.py index 5a0418b37..582dba2ff 100644 --- a/nominatim/db/sqlalchemy_functions.py +++ b/nominatim/db/sqlalchemy_functions.py @@ -216,7 +216,7 @@ class RegexpWord(sa.sql.functions.GenericFunction[Any]): @compiles(RegexpWord, 'postgresql') # type: ignore[no-untyped-call, misc] def postgres_regexp_nocase(element: RegexpWord, compiler: 'sa.Compiled', **kw: Any) -> str: arg1, arg2 = list(element.clauses) - return "regexp_like(%s, '\\m(' || %s || ')\\M', 'i')" % (compiler.process(arg2, **kw), compiler.process(arg1, **kw)) + return "regexp_like(%s, '\\m(' || %s || ')\\M', 'i'::text)" % (compiler.process(arg2, **kw), compiler.process(arg1, **kw)) @compiles(RegexpWord, 'sqlite') # type: ignore[no-untyped-call, misc] def sqlite_regexp_nocase(element: RegexpWord, compiler: 'sa.Compiled', **kw: Any) -> str: