Opened 7 months ago

Last modified 7 months ago

#35262 closed Bug

Addindex operation generates wrong sql code for Postgresql GinIndex — at Initial Version

Reported by: Pierre Juhen Owned by: nobody
Component: contrib.postgres Version: 5.0
Severity: Normal Keywords:
Cc: Pierre Juhen Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi,

I have created a Gin Index using the folowing code in models.py

GinIndex(OpClass(Lower('historique'), name='gin_trgm_ops'), name="name_gin_trgm_histo_affaire")

It generates a migration operation :

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 :

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 :

CREATE INDEX "name_gin_trgm_histo_affaire" ON "affaires_affaire" USING gin (LOWER("historique") );

that accepted by postgresql.

Thanks,

Regards,

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top