#35262: Addindex operation generates wrong sql code for Postgresql GinIndex
-----------------------------------------+------------------------
               Reporter:  pjuhen         |          Owner:  nobody
                   Type:  Bug            |         Status:  new
              Component:  Uncategorized  |        Version:  5.0
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 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,
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35262>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018df59f40fb-54b1e473-8032-4f13-a946-dd56ed673e7b-000000%40eu-central-1.amazonses.com.

Reply via email to