﻿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
35311	Addindex operation generates wrong sql code for Postgresql GinIndex	Pierre Juhen	nobody	"Hi,

I created a Gin Index using :

''GinIndex(OpClass(Lower('title'),      name='gin_trgm_ops'), name=""name_gin_trgm_title_affaire""),''

makemigrations generates the following code :

''migrations.AddIndex(
           '' model_name='affaire',
            index=django.contrib.postgres.indexes.GinIndex(django.contrib.postgres.indexes.OpClass(django.db.models.functions.text.Lower('title'), name='gin_trgm_ops'), name='name_gin_trgm_title_affaire'),''
        ),''

SQLMIGRATE generates a wrong code :

''CREATE INDEX ""name_gin_trgm_title_affaire"" ON ""affaires_affaire"" USING gin ((LOWER(""title""), name=gin_trgm_ops));''

Instead of (too many parenthesis) :

''CREATE INDEX ""name_gin_trgm_title_affaire"" ON ""affaires_affaire"" USING gin (LOWER(""title""),  name=gin_trgm_ops);''

There is a manual workaround, but its annoying.

Thank you.

Regards"	Bug	new	Database layer (models, ORM)	5.0	Normal		postgresql migration	Pierre Juhen	Unreviewed	0	0	0	0	0	0
