#35262 closed Bug (duplicate)
Addindex operation generates wrong sql code for Postgresql GinIndex
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 (last modified by )
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.
Change History (3)
comment:1 by , 9 months ago
Component: | Uncategorized → contrib.postgres |
---|---|
Description: | modified (diff) |
comment:2 by , 9 months ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
comment:3 by , 8 months ago
Resolution: | worksforme → duplicate |
---|
Note:
See TracTickets
for help on using tickets.
It works for me and is covered in our test suite.