Changes between Initial Version and Version 1 of Ticket #35262


Ignore:
Timestamp:
Feb 29, 2024, 6:29:04 PM (9 months ago)
Author:
Tim Graham
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #35262

    • Property Component Uncategorizedcontrib.postgres
  • Ticket #35262 – Description

    initial v1  
    1 Hi,
    2 
    31I have created a Gin Index using the folowing code in models.py
    4 
    5 ''GinIndex(OpClass(Lower('historique'), name='gin_trgm_ops'), name="name_gin_trgm_histo_affaire")''
    6 
     2{{{#!python
     3GinIndex(OpClass(Lower('historique'), name='gin_trgm_ops'), name="name_gin_trgm_histo_affaire")
     4}}}
    75It generates a migration operation :
    86
    9 ''migrations.AddIndex(
    10             model_name='affaire',
    11             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'),
    12         ),
    13 
    14 ''
     7{{{#!python
     8migrations.AddIndex(
     9    model_name='affaire',
     10    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'),
     11)
     12}}}
    1513
    1614The SQL generated instruction is :
    1715
    18 
    19 ''CREATE INDEX "name_gin_trgm_histo_affaire" ON "affaires_affaire" USING gin ((LOWER("historique") gin_trgm_ops));''
    20 
     16{{{#!sql
     17CREATE INDEX "name_gin_trgm_histo_affaire" ON "affaires_affaire" USING gin ((LOWER("historique") gin_trgm_ops));
     18}}}
    2119It is refused by postgresql.
    2220
    2321The right code might be :
    24 
     22{{{#!sql
    2523CREATE INDEX "name_gin_trgm_histo_affaire" ON "affaires_affaire" USING gin (LOWER("historique") );
    26 
     24}}}
    2725that accepted by postgresql.
    28 
    29 Thanks,
    30 
    31 Regards,
    32 
    33 
    34 
Back to Top