﻿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
35262	Addindex operation generates wrong sql code for Postgresql GinIndex	Pierre Juhen	nobody	"I have created a Gin Index using the folowing code in models.py
{{{#!python
GinIndex(OpClass(Lower('historique'), name='gin_trgm_ops'), name=""name_gin_trgm_histo_affaire"")
}}}
It generates a migration operation :

{{{#!python
migrations.AddIndex(
    model_name='affaire',
    index=django.contrib.postgres.indexes.GinIndex(django.contrib.postgres.indexes.OpClass(django.db.models.functions.text.Lower('historique'), name='gin_trgm_ops'), name='name_gin_trgm_histo_affaire'),
)
}}}

The SQL generated instruction is :

{{{#!sql
CREATE INDEX ""name_gin_trgm_histo_affaire"" ON ""affaires_affaire"" USING gin ((LOWER(""historique"") gin_trgm_ops));
}}}
It is refused by postgresql.

The right code might be :
{{{#!sql
CREATE INDEX ""name_gin_trgm_histo_affaire"" ON ""affaires_affaire"" USING gin (LOWER(""historique"") );
}}}
that accepted by postgresql."	Bug	closed	contrib.postgres	5.0	Normal	duplicate		Pierre Juhen	Unreviewed	0	0	0	0	0	0
