#30903: Creating an index with specified ordering and opclass results in syntax
error
-------------------------------------+-------------------------------------
               Reporter:  Hannes     |          Owner:  Hannes Ljungberg
  Ljungberg                          |
                   Type:  Bug        |         Status:  assigned
              Component:  Database   |        Version:  2.2
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:  db-indexes
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 Creating an index on postgres with both order and opclass specified
 crashes with a syntax error.

 {{{#!python
 index = Index(
     name=indexname,
     fields=['-body'],
     opclasses=['text_pattern_ops'],
 )
 }}}

 {{{
 django.db.utils.ProgrammingError: syntax error at or near
 "text_pattern_ops"
 LINE 1: ...rdered" ON "indexes_indexedarticle2" ("body" DESC text_patte...
 }}}

 This is because `opclass` is supposed to be inserted before `ASC | DESC`
 in `CREATE INDEX`.

 See https://www.postgresql.org/docs/current/sql-createindex.html

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30903>
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.8b14b259c09d10f43ae538e9f3c05e23%40djangoproject.com.

Reply via email to