﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
25538	Clarify the operator that icontains uses on Postgresql	Artyem Klimenko	nobody	"https://docs.djangoproject.com/en/1.8/ref/models/querysets/#icontains
> SQL equivalent:
> SELECT ... WHERE headline ILIKE '%Lennon%';
ilike exist in PostgreSQL, but not used, and it is not obvious.

{{{
q = NetworkObject.objects.filter(string_view__icontains='test').only('id')
print(q.query)
SELECT ""core_networkobject"".""id"" FROM ""core_networkobject"" WHERE UPPER(""core_networkobject"".""string_view""::text) LIKE UPPER(%test%)
}}}

I understand that you can not correct the behavior icontains, but you can clarify this issue in the documentation.

And maybe add to the documentation this lookup.
{{{
from django.db import models
from django.db.models.lookups import IContains

class PostgreILike(IContains):
    lookup_name = 'ilike'

    def as_postgresql(self, compiler, connection):
        lhs, lhs_params = self.process_lhs(compiler, connection)
        rhs, rhs_params = self.process_rhs(compiler, connection)
        params = lhs_params + rhs_params
        return '%s ILIKE %s' % (lhs, rhs), params

models.CharField.register_lookup(PostgreILike)
models.TextField.register_lookup(PostgreILike)
}}}

P.S. Sorry for my poor English."	Cleanup/optimization	closed	Documentation	1.8	Normal	duplicate	postgresql icontains ilike		Unreviewed	0	0	0	0	0	0
