Re: Proposal: Add simply way to use upper index in Meta.models.indexes

2020-04-05 Thread Павел Гаркин
Hi Hannes, Thanks for reply. I get AttribueError error when try to use Upper field name as you wrote. from django.db.models.functions import Upper class TestSubject(models.Model): name = models.CharField(max_length=255) class Meta: indexes = [ models.Index(fields=[U

Re: Proposal: Add simply way to use upper index in Meta.models.indexes

2020-04-03 Thread Adam Johnson
Hannes, thank you for working on this PR! I hope we can get it into Django 3.1. Pavel, I think the SQL in the documentation is for illustration purposes only. It seems ILIKE is not used on PostgreSQL only, as it does the UPPER / ::text conversion in its backend: https://github.com/django/django/bl

Re: Proposal: Add simply way to use upper index in Meta.models.indexes

2020-04-03 Thread Hannes Ljungberg
Hi Pavel, I think this is best solved by adding support for indexes on expressions. This would allow for indexes to be defined as: class Meta: indexes = [ Index(fields=[Upper('name')], name='upper_name_idx') ] There's an open ticket for this https://code.djangoproject.com/ticke

Proposal: Add simply way to use upper index in Meta.models.indexes

2020-04-03 Thread Павел Гаркин
Hi, Django ORM uses UPPER operator when using *__iexact *operator https://code.djangoproject.com/ticket/3575 I have faced performance degradation when querying with *iexact* operator. Example model class Subject(models.Model): name = models.CharField(max_length=255) class Meta: